From 7e9e1d122c2024a95125a6b6b07d907bdcb97397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Thu, 31 Mar 2016 16:01:17 +0200 Subject: [PATCH] Added setup.py so we can package the addon as ZIP. `python setup.py bdist` creates dist/blender_cloud*.addon.zip, which can be installed by Blender. --- .gitignore | 2 ++ setup.py | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100755 setup.py diff --git a/.gitignore b/.gitignore index 7cd8650..7eab516 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ blender_cloud/wheels/*.whl /textures*/ /test_*.py +/dist/ +/build/ diff --git a/setup.py b/setup.py new file mode 100755 index 0000000..4a27830 --- /dev/null +++ b/setup.py @@ -0,0 +1,64 @@ +#!/usr/bin/env python + +from distutils.command.bdist import bdist +from distutils.command.install import install +from distutils.command.install_egg_info import install_egg_info +from setuptools import setup, find_packages +from glob import glob + + +class BlenderAddonBdist(bdist): + """Ensures that 'python setup.py bdist' creates a zip file.""" + + def initialize_options(self): + super().initialize_options() + self.formats = ['zip'] + self.plat_name = 'addon' # use this instead of 'linux-x86_64' or similar. + + +class BlenderAddonInstall(install): + """Ensures the module is placed at the root of the zip file.""" + + def initialize_options(self): + super().initialize_options() + self.prefix = '' + self.install_lib = '' + + +class AvoidEggInfo(install_egg_info): + """Makes sure the egg-info directory is NOT created. + + If we skip this, the user's addon directory will be polluted by egg-info + directories, which Blender doesn't use anyway. + """ + + def run(self): + pass + + +setup( + cmdclass={'bdist': BlenderAddonBdist, + 'install': BlenderAddonInstall, + 'install_egg_info': AvoidEggInfo}, + name='blender_cloud', + description='The Blender Cloud addon allows browsing the Blender Cloud from Blender.', + version='1.0.0', + author='Sybren A. Stüvel', + author_email='sybren@stuvel.eu', + packages=find_packages('.'), + data_files=[('blender_cloud', ['README.md']), + ('blender_cloud/wheels', glob('blender_cloud/wheels/*.whl'))], + scripts=[], + url='https://developer.blender.org/diffusion/BCA/', + license='GNU General Public License v2 or later (GPLv2+)', + platforms='', + classifiers=[ + 'Intended Audience :: End Users/Desktop', + 'Operating System :: OS Independent', + 'Environment :: Plugins', + 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3.5', + ], + zip_safe=False, +)