def setup(*args, **kwargs): """Mangle setup to ignore media-relay on non-linux platforms""" if not sys.platform.startswith('linux2'): print "WARNING: skipping the media relay component as this is a non-linux platform" kwargs.pop('ext_modules', None) kwargs['scripts'].remove('media-relay') _setup(*args, **kwargs)
def setup(*args): args = list(args) print("version: " + _version) _checkRequirements() # may be running in a different dir, temp change dir into # dir of setup file curdir = os.path.abspath(os.getcwd()) print("changing dir to " + _basedir) os.chdir(_basedir) # copy stuff if we are building # if len(args) > 0 and args[0].lower().find('dist') >= 0: # print ("we're building...") # _copyDistFiles() # always copy windows dlls _copyDistFiles() # check if we are running in Mac Spyder, and /Users/andy/local/dist/pylibroadrunner-1.1.1-macosx_x86_64/setup.py # called with no args if sys.exec_prefix.find("Spyder.app") >= 0 and len(args) == 0: args.append("install") args.append("--prefix=" + sys.exec_prefix) print("installing into Spyder using args: " + str(args)) _setup( name='pylibroadrunner', author='Andy Somogyi, Herbert Sauro', author_email='*****@*****.**', version=_version, description='libRoadRunner SBML JIT compiler and simulation library', url='http://libroadrunner.org', packages=['roadrunner', 'roadrunner.testing', 'roadrunner.stochastic'], package_dir={ "roadrunner": "site-packages/roadrunner", "roadrunner.testing": "site-packages/roadrunner/testing", "roadrunner.stochastic": "site-packages/roadrunner/stochastic" }, package_data={ # add dll, won't hurt unix, not there anyway "roadrunner": ["_roadrunner." + _sharedLibExt(), "*.dll", "*.txt"], "roadrunner.testing": [ "*.xml", "*.txt", "*.dat", "dsmts/*.xml", "dsmts/*.csv", "test_data/*" ] }, cmdclass={'sdist': _RoadRunnerSDist}, # fake out the command line args script_name='setup.py', script_args=args) #change dir back print("changeing back to " + curdir) os.chdir(curdir)
def setup(*args): args = list(args) print("version: " + _version) _checkRequirements() # may be running in a different dir, temp change dir into # dir of setup file curdir = os.path.abspath(os.getcwd()) print("changing dir to " + _basedir) os.chdir(_basedir) # copy stuff if we are building # if len(args) > 0 and args[0].lower().find('dist') >= 0: # print ("we're building...") # _copyDistFiles() # always copy windows dlls _copyDistFiles() # check if we are running in Mac Spyder, and /Users/andy/local/dist/pylibroadrunner-1.1.1-macosx_x86_64/setup.py # called with no args if sys.exec_prefix.find("Spyder.app") >= 0 and len(args) == 0: args.append("install") args.append("--prefix=" + sys.exec_prefix) print("installing into Spyder using args: " + str(args)) _setup(name='pylibroadrunner', author='Andy Somogyi, Herbert Sauro', author_email='*****@*****.**', version=_version, description='libRoadRunner SBML JIT compiler and simulation library', url='http://libroadrunner.org', packages=['roadrunner', 'roadrunner.testing', 'roadrunner.stochastic'], package_dir={ "roadrunner" : "site-packages/roadrunner", "roadrunner.testing" : "site-packages/roadrunner/testing", "roadrunner.stochastic" : "site-packages/roadrunner/stochastic" }, package_data={ # add dll, won't hurt unix, not there anyway "roadrunner" : ["_roadrunner." + _sharedLibExt(), "*.dll", "*.txt" ], "roadrunner.testing" : ["*.xml", "*.txt", "*.dat", "dsmts/*.xml", "dsmts/*.csv", "test_data/*"] }, cmdclass={'sdist' : _RoadRunnerSDist}, # fake out the command line args script_name = 'setup.py', script_args = args ) #change dir back print("changeing back to " + curdir) os.chdir(curdir)
def setup(cls, **kwargs): packages = cls.get_packages() if not packages: return d = { 'packages': packages, } d.update(kwargs) _setup(**d)
def setup(**attrs): """Replace default Distribution class.""" srcdir = attrs.setdefault('srcdir', os.path.dirname(sys.argv[0])) # Get version from git, if available if 'version' not in attrs: try: attrs['version'] = get_git_version(srcdir) except ValueError: pass # Set default Distribution class attrs.setdefault('distclass', Distribution) # Set default script_name full attrs.setdefault('script_name', sys.argv[0]) # Call original 'setup()' _setup(**attrs)
def setup(**attrs): if 'distclass' not in attrs: from Ft.Lib.DistExt.PackageManager import PackageManager attrs['distclass'] = PackageManager # Only needed for Python 2.2 try: return _setup(**attrs) except DistutilsError, error: if DEBUG: raise raise SystemExit('error: ' + str(error))
def setup(*args, **kwargs): cmdclass = kwargs.setdefault('cmdclass', {}) kwargs['cmdclass'].setdefault('test', test) kwargs['cmdclass'].setdefault('install_data', install_data) kwargs['cmdclass'].setdefault('install_lib', install_lib) kwargs['cmdclass'].setdefault('build_man', build_man) kwargs['cmdclass'].setdefault('install_man', install_man) kwargs['cmdclass'].setdefault('clean', clean) if py2exe is not None: kwargs['cmdclass'].setdefault('py2exe', py2exe) return _setup(*args, **kwargs)
def setup(mode=None): """Call setup after monkey-patching with the given mode. Parameters ---------- mode: None/str 'distutils' or 'setuptools' for now """ if mode is None: if "setuptools" in sys.modules: mode = "setuptools" else: mode = "distutils" if not mode in ("distutils", "setuptools"): raise ValueError("Only 'setuptools' and 'distutils' are supported modes") __import__(mode) monkey_patch() from distutils.core import setup as _setup return _setup()
def setup(mode=None): """Call setup after monkey-patching with the given mode. Parameters ---------- mode: None/str 'distutils' or 'setuptools' for now """ if mode is None: if "setuptools" in sys.modules: mode = "setuptools" else: mode = "distutils" if not mode in ("distutils", "setuptools"): raise ValueError( "Only 'setuptools' and 'distutils' are supported modes") __import__(mode) monkey_patch() from distutils.core import setup as _setup return _setup()
def setup(**kwargs): if 'requires' not in kwargs: requirements_txt = os.path.join(os.getcwd(), "requirements.txt") if os.path.exists(requirements_txt): with open(requirements_txt) as f: lines = f.readlines() kwargs['requires'] = [l.strip() for l in lines if l.strip()] if 'packages' not in kwargs and 'package_dir' not in kwargs and 'source_dir' in kwargs: # kwargs['package_dir'] = {'':kwargs['source_dir']} kwargs['package_dir'] = _find_packages(kwargs['source_dir']) del kwargs['source_dir'] kwargs['packages'] = list(kwargs['package_dir'].keys()) if 'scripts' not in kwargs and 'script_dir' in kwargs: scripts = [ os.path.join(kwargs['script_dir'], f) for f in os.listdir(kwargs['script_dir']) if not '~' in f and not '#' in f ] del kwargs['script_dir'] if scripts: kwargs['scripts'] = scripts return _setup(**kwargs)
if __name__ == '__main__': sio = _StringIO() serr = _sys.stderr _sys.stderr = sio try: print("pulling constants from " + _HEADER_PATH) consts = _pull_consts_from_header() print("pulling topic enum from " + _HEADER_PATH) topics = _pull_topics_from_header() print('auto-generating ' + _OUTPUT_PATH) _create__tosdb(consts, topics) print(' checking ' + _OUTPUT_PATH) try: exec("from " + NAME + " import " + _AUTO_EXT) except ImportError as ie: print(' fatal: auto-generated ' + _OUTPUT_PATH + ' could not be imported !') print(' fatal: ' + ie.args[0]) exit(1) print(' success!') _setup(name=NAME, version=VERSION, description=DESCRIPTION, author=AUTHOR, author_email=AUTHOR_EMAIL, packages=PACKAGES) finally: _sys.stderr = serr if sio.getvalue(): print( '\n', "+ Operation 'completed' with errors:\n") print(sio.getvalue())
def setup(**kwargs): if "akara_extensions" not in kwargs: raise SystemExit(MISSING_AKARA_EXTENSIONS) for filename in kwargs["akara_extensions"]: if not filename.endswith(".py"): raise SystemExit("Akara extensions must end with '.py' not %r" % (filename, )) for filename in kwargs.get("akara_extension_confs", []): if not filename.endswith(".conf"): raise SystemExit( "Akara extension configuration files must end with '.conf' not %r" % (filename, )) new_kwargs = kwargs.copy() # Create our new installation code. # Figure out which command class to wrap. cmdclass = new_kwargs.get('cmdclass', {}) if 'install' in cmdclass: install = cmdclass['install'] else: install = old_install # A hook to add our own extensions class my_install(install): sub_commands = install.sub_commands + [ ('install_akara_extensions', None) ] user_options = install.user_options + EXTENSION_OPTIONS def initialize_options(self): install.initialize_options(self) self.akara_config = None self.akara_modules_dir = None # Our installation extension class install_akara_extensions(Command): description = "Command to install akara extensions" user_options = EXTENSION_OPTIONS def initialize_options(self): # I so don't know what I'm doing here, but it seems to work. args = self.distribution.command_options["install"] self.akara_modules_dir = self.akara_config = None for key, value in args.items(): if key == "akara_modules_dir": self.akara_modules_dir = value[1] elif key == "akara_config": self.akara_config = value[1] def finalize_options(self): if self.akara_modules_dir is None: settings, config = akara.read_config.read_config( self.akara_config) self.akara_modules_dir = settings["module_dir"] def run(self): dist = self.distribution for (description, filenames) in (("extension", dist.akara_extensions), ("configuration", dist.akara_extension_confs)): for filename in filenames: log.info("Installing Akara %s %r in %r" % (description, filename, self.akara_modules_dir)) if not self.dry_run: if not os.path.isdir(self.akara_modules_dir): os.makedirs(self.akara_modules_dir ) # Make sure the directory exists shutil.copy(filename, self.akara_modules_dir) new_cmdclass = {} new_cmdclass.update(cmdclass) new_cmdclass['install'] = my_install new_cmdclass['install_akara_extensions'] = install_akara_extensions new_kwargs['cmdclass'] = new_cmdclass # Handle overriden distclass if 'distclass' in new_kwargs: Distribution = new_kwargs['distclass'] else: Distribution = _Distribution class MyDistribution(Distribution): def __init__(self, attrs=None): for opt in ("akara_extensions", "akara_extension_confs"): assert not hasattr(self, opt) setattr(self, opt, attrs.get(opt, [])) Distribution.__init__(self, attrs) new_kwargs['distclass'] = MyDistribution return _setup(**new_kwargs)
#!/usr/bin/env python from distutils.core import setup as _setup if __name__ == '__main__': _setup( name='appelize', version='0.3', description= 'This program "appelizes" your music into a separate directory.', author='Klaus Umbach', author_email='*****@*****.**', url='https://github.com/treibholz/appelize', scripts=[ 'appelize', ], )
def setup(cls, **kwargs): packages = cls.get_packages() if packages: kwargs.update(packages=packages) _setup(**kwargs)
_setup( name=_package_name, version=__version__, maintainer=_maintainer_name, maintainer_email=_maintainer_email, url='https://wiki.gentoo.org/wiki/Catalyst', download_url='http://distfiles.gentoo.org/distfiles/{0}-{1}.tar.bz2'. format(_package_name, __version__), license='GNU General Public License (GPL)', platforms=['all'], description=__doc__, long_description=_codecs.open(_os.path.join(_this_dir, 'README'), 'r', 'utf-8').read(), classifiers=[ 'Development Status :: 5 - Production/Stable', 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', 'Intended Audience :: System Administrators', 'Operating System :: POSIX', 'Topic :: System :: Archiving :: Packaging', 'Topic :: System :: Installation/Setup', 'Topic :: System :: Software Distribution', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', ], scripts=['bin/{0}'.format(_package_name)], packages=[ _package_name, '{0}.arch'.format(_package_name), '{0}.base'.format(_package_name), '{0}.targets'.format(_package_name), ], data_files=_data_files, provides=[_package_name], cmdclass={'set_version': set_version}, )
class CleanCommand(_Clean): description = "clean tosdb" def run(self): try: print("removing tosdb/_tosdb.py ...") _remove(_OUTPUT_PATH) except: pass try: print("removing ./build ...") _rmtree(_path_join(_OUR_PATH, 'build')) except: pass super().run() _setup(name=NAME, version=VERSION, description=DESCRIPTION, author=AUTHOR, author_email=AUTHOR_EMAIL, packages=PACKAGES, cmdclass={ 'install': InstallCommand, 'build': BuildCommand, 'clean': CleanCommand })
_this_dir = _os_path.dirname(__file__) _setup( name='quizzer', version=__version__, maintainer='W. Trevor King', maintainer_email='*****@*****.**', url='http://blog.tremily.us/posts/quizzer/', download_url='http://git.tremily.us/?p=quizzer.git;a=snapshot;h=v{};sf=tgz'.format(__version__), license = 'GNU General Public License (GPL)', platforms = ['all'], description = __doc__, long_description=_codecs.open( _os_path.join(_this_dir, 'README'), 'r', 'utf-8').read(), classifiers = [ 'Development Status :: 3 - Alpha', 'Intended Audience :: Education', 'Operating System :: OS Independent', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Topic :: Education', 'Topic :: Education :: Computer Aided Instruction (CAI)', ], scripts = ['pq.py'], packages = ['quizzer', 'quizzer.ui'], provides = ['quizzer', 'quizzer.ui'], )
_setup( name='pygrader', version=__version__, maintainer='W. Trevor King', maintainer_email='*****@*****.**', url='http://blog.tremily.us/posts/pygrader/', download_url='http://git.tremily.us/?p=pygrader.git;a=snapshot;h=v{};sf=tgz'.format(__version__), license = 'GNU General Public License (GPL)', platforms = ['all'], description = __doc__, long_description=open(_os_path.join(_this_dir, 'README'), 'r').read(), classifiers = [ 'Development Status :: 3 - Alpha', 'Intended Audience :: Education', 'Operating System :: OS Independent', 'License :: OSI Approved :: GNU General Public License (GPL)', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Topic :: Communications :: Email', 'Topic :: Database', 'Topic :: Education', ], scripts = ['bin/pg.py'], packages = [ 'pygrader', 'pygrader.handler', 'pygrader.model', 'pygrader.test'], provides = [ 'pygrader', 'pygrader.handler', 'pygrader.model', 'pygrader.test'], )
import mutt_ldap as _mutt_ldap _this_dir = _os_path.dirname(__file__) _setup( name='mutt-ldap', version=_mutt_ldap.__version__, maintainer='W. Trevor King', maintainer_email='*****@*****.**', url='http://blog.tremily.us/posts/mutt-ldap/', download_url='http://git.tremily.us/?p=mutt-ldap.git;a=snapshot;h=v{};sf=tgz'.format(_mutt_ldap.__version__), license = 'GNU General Public License (GPL)', platforms = ['all'], description = _mutt_ldap.__doc__.splitlines()[0], long_description=open(_os_path.join(_this_dir, 'README'), 'r').read(), classifiers = [ 'Development Status :: 3 - Alpha', 'Intended Audience :: End Users/Desktop', 'Operating System :: OS Independent', 'License :: OSI Approved :: GNU General Public License (GPL)', 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Topic :: Communications :: Email', ], py_modules = ['mutt_ldap'], scripts = ['mutt_ldap.py'], )
#!/usr/bin/env python from distutils.core import setup as _setup if __name__ == '__main__': _setup( name = 'appelize', version = '0.3', description = 'This program "appelizes" your music into a separate directory.', author = 'Klaus Umbach', author_email = '*****@*****.**', url = 'https://github.com/treibholz/appelize', scripts = [ 'appelize', ], )
_setup( name=_package_name, version=__version__, maintainer=_maintainer_name, maintainer_email=_maintainer_email, url='https://wiki.gentoo.org/wiki/Catalyst', download_url='http://distfiles.gentoo.org/distfiles/{0}-{1}.tar.bz2'.format( _package_name, __version__), license='GNU General Public License (GPL)', platforms=['all'], description=__doc__, long_description=_codecs.open( _os.path.join(_this_dir, 'README'), 'r', 'utf-8').read(), classifiers=[ 'Development Status :: 5 - Production/Stable', 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', 'Intended Audience :: System Administrators', 'Operating System :: POSIX', 'Topic :: System :: Archiving :: Packaging', 'Topic :: System :: Installation/Setup', 'Topic :: System :: Software Distribution', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', ], scripts=['bin/{0}'.format(_package_name)], packages=[ _package_name, '{0}.arch'.format(_package_name), '{0}.base'.format(_package_name), '{0}.targets'.format(_package_name), ], data_files=_data_files, provides=[_package_name], cmdclass={ 'set_version': set_version }, )
_this_dir = _os_path.dirname(__file__) _setup( name='pyassuan', version=__version__, maintainer='W. Trevor King', maintainer_email='*****@*****.**', url='http://blog.tremily.us/posts/pyassuan/', download_url='http://git.tremily.us/?p=pyassuan.git;a=snapshot;h=v{};sf=tgz' .format(__version__), license='GNU General Public License (GPL)', platforms=['all'], description=__doc__, long_description=open(_os_path.join(_this_dir, 'README'), 'r').read(), classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'License :: OSI Approved :: GNU General Public License (GPL)', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Topic :: Security :: Cryptography', 'Topic :: Software Development' ], scripts=['bin/get-info.py', 'bin/pinentry.py'], packages=['pyassuan'], provides=['pyassuan'], )
_this_dir = _os_path.dirname(__file__) _setup( name="update-copyright", version=__version__, maintainer="W. Trevor King", maintainer_email="*****@*****.**", url="http://blog.tremily.us/posts/update-copyright/", download_url="http://git.tremily.us/?p=update-copyright.git;a=snapshot;h=v{};sf=tgz".format(__version__), license="GNU General Public License (GPL)", platforms=["all"], description=__doc__, long_description=_codecs.open(_os_path.join(_this_dir, "README"), "r", encoding="utf-8").read(), classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Operating System :: OS Independent", "License :: OSI Approved :: GNU General Public License (GPL)", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Topic :: Software Development", ], scripts=["bin/update-copyright.py"], packages=["update_copyright", "update_copyright.vcs"], provides=["update_copyright", "update_copyright.vcs"], )
sio = _StringIO() serr = _sys.stderr _sys.stderr = sio try: print("pulling constants from " + _HEADER_PATH) consts = _pull_consts_from_header() print("pulling topic enum from " + _HEADER_PATH) topics = _pull_topics_from_header() print('auto-generating ' + _OUTPUT_PATH) _create__tosdb(consts, topics) print(' checking ' + _OUTPUT_PATH) try: exec("from " + NAME + " import " + _AUTO_EXT) except ImportError as ie: print(' fatal: auto-generated ' + _OUTPUT_PATH + ' could not be imported !') print(' fatal: ' + ie.args[0]) exit(1) print(' success!') _setup(name=NAME, version=VERSION, description=DESCRIPTION, author=AUTHOR, author_email=AUTHOR_EMAIL, packages=PACKAGES) finally: _sys.stderr = serr if sio.getvalue(): print('\n', "+ Operation 'completed' with errors:\n") print(sio.getvalue())
_this_dir = _os_path.dirname(__file__) _setup( name='pyassuan', version=__version__, maintainer='W. Trevor King', maintainer_email='*****@*****.**', url='http://blog.tremily.us/posts/pyassuan/', download_url='http://git.tremily.us/?p=pyassuan.git;a=snapshot;h=v{};sf=tgz'.format(__version__), license = 'GNU General Public License (GPL)', platforms = ['all'], description = __doc__, long_description=open(_os_path.join(_this_dir, 'README'), 'r').read(), classifiers = [ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'Operating System :: OS Independent', 'License :: OSI Approved :: GNU General Public License (GPL)', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', 'Topic :: Security :: Cryptography', 'Topic :: Software Development' ], scripts = ['bin/get-info.py', 'bin/pinentry.py'], packages = ['pyassuan'], provides = ['pyassuan'], )
class BuildCommand(_Build): description = "build tosdb" def run(self): _init_build() super().run() class CleanCommand(_Clean): description = "clean tosdb" def run(self): try: print("removing tosdb/_tosdb.py ...") _remove(_OUTPUT_PATH) except: pass try: print("removing ./build ...") _rmtree( _path_join(_OUR_PATH,'build') ) except: pass super().run() _setup( name=NAME, version=VERSION, description=DESCRIPTION, author=AUTHOR, author_email=AUTHOR_EMAIL, packages=PACKAGES, cmdclass={'install':InstallCommand, 'build':BuildCommand, 'clean':CleanCommand} )
_setup( name=_package_name, version=__version__, maintainer=_maintainer_name, maintainer_email=_maintainer_email, url='http://www.gentoo.org/proj/en/releng/{0}/'.format(_package_name), download_url='http://distfiles.gentoo.org/distfiles/{0}-{1}.tar.bz2'.format( _package_name, __version__), license='GNU General Public License (GPL)', platforms=['all'], description=__doc__, long_description=_codecs.open( _os.path.join(_this_dir, 'README'), 'r', 'utf-8').read(), classifiers=[ 'Development Status :: 5 - Production/Stable', 'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)', 'Intended Audience :: System Administrators', 'Operating System :: POSIX', 'Topic :: System :: Archiving :: Packaging', 'Topic :: System :: Installation/Setup', 'Topic :: System :: Software Distribution', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.7', ], scripts=['bin/{0}'.format(_package_name)], packages=[ _package_name, '{0}.arch'.format(_package_name), '{0}.targets'.format(_package_name), ], data_files=list(_itertools.chain( _files(prefix='/etc/catalyst', root='etc'), _files(prefix='lib/catalyst/livecd', root='livecd'), _files(prefix='lib/catalyst/targets', root='targets'), )), provides=[_package_name], )
def setup(**kwargs): if "akara_extensions" not in kwargs: raise SystemExit(MISSING_AKARA_EXTENSIONS) for filename in kwargs["akara_extensions"]: if not filename.endswith(".py"): raise SystemExit("Akara extensions must end with '.py' not %r" % (filename,)) for filename in kwargs.get("akara_extension_confs", []): if not filename.endswith(".conf"): raise SystemExit("Akara extension configuration files must end with '.conf' not %r" % (filename,)) new_kwargs = kwargs.copy() # Create our new installation code. # Figure out which command class to wrap. cmdclass = new_kwargs.get("cmdclass", {}) if "install" in cmdclass: install = cmdclass["install"] else: install = old_install # A hook to add our own extensions class my_install(install): sub_commands = install.sub_commands + [("install_akara_extensions", None)] user_options = install.user_options + EXTENSION_OPTIONS def initialize_options(self): install.initialize_options(self) self.akara_config = None self.akara_modules_dir = None # Our installation extension class install_akara_extensions(Command): description = "Command to install akara extensions" user_options = EXTENSION_OPTIONS def initialize_options(self): # I so don't know what I'm doing here, but it seems to work. args = self.distribution.command_options["install"] self.akara_modules_dir = self.akara_config = None for key, value in args.items(): if key == "akara_modules_dir": self.akara_modules_dir = value[1] elif key == "akara_config": self.akara_config = value[1] def finalize_options(self): if self.akara_modules_dir is None: settings, config = akara.read_config.read_config(self.akara_config) self.akara_modules_dir = settings["module_dir"] def run(self): dist = self.distribution for (description, filenames) in ( ("extension", dist.akara_extensions), ("configuration", dist.akara_extension_confs), ): for filename in filenames: log.info("Installing Akara %s %r in %r" % (description, filename, self.akara_modules_dir)) if not self.dry_run: if not os.path.isdir(self.akara_modules_dir): os.makedirs(self.akara_modules_dir) # Make sure the directory exists shutil.copy(filename, self.akara_modules_dir) new_cmdclass = {} new_cmdclass.update(cmdclass) new_cmdclass["install"] = my_install new_cmdclass["install_akara_extensions"] = install_akara_extensions new_kwargs["cmdclass"] = new_cmdclass # Handle overriden distclass if "distclass" in new_kwargs: Distribution = new_kwargs["distclass"] else: Distribution = _Distribution class MyDistribution(Distribution): def __init__(self, attrs=None): for opt in ("akara_extensions", "akara_extension_confs"): assert not hasattr(self, opt) setattr(self, opt, attrs.get(opt, [])) Distribution.__init__(self, attrs) new_kwargs["distclass"] = MyDistribution return _setup(**new_kwargs)