setup.py
changeset 11282 386fff3fa2ff
parent 11276 6eeb7abda47a
child 11424 1451f040555f
child 11420 b5cd8a2cccab
equal deleted inserted replaced
11281:2cb8b383a519 11282:386fff3fa2ff
    69 
    69 
    70 distname = __pkginfo__.get('distname', modname)
    70 distname = __pkginfo__.get('distname', modname)
    71 scripts = __pkginfo__.get('scripts', ())
    71 scripts = __pkginfo__.get('scripts', ())
    72 include_dirs = __pkginfo__.get('include_dirs', ())
    72 include_dirs = __pkginfo__.get('include_dirs', ())
    73 data_files = __pkginfo__.get('data_files', None)
    73 data_files = __pkginfo__.get('data_files', None)
    74 subpackage_of = __pkginfo__.get('subpackage_of', None)
       
    75 ext_modules = __pkginfo__.get('ext_modules', None)
    74 ext_modules = __pkginfo__.get('ext_modules', None)
    76 package_data = __pkginfo__.get('package_data', {})
    75 package_data = __pkginfo__.get('package_data', {})
    77 
    76 
    78 BASE_BLACKLIST = ('CVS', 'dist', 'build', '__buildlog')
    77 BASE_BLACKLIST = ('CVS', 'dist', 'build', '__buildlog')
    79 IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc')
    78 IGNORED_EXTENSIONS = ('.pyc', '.pyo', '.elc')
   150     """
   149     """
   151     def run(self):
   150     def run(self):
   152         """overridden from install_lib class"""
   151         """overridden from install_lib class"""
   153         install_lib.install_lib.run(self)
   152         install_lib.install_lib.run(self)
   154         # create Products.__init__.py if needed
   153         # create Products.__init__.py if needed
   155         if subpackage_of:
       
   156             product_init = join(self.install_dir, subpackage_of, '__init__.py')
       
   157             if not exists(product_init):
       
   158                 self.announce('creating %s' % product_init)
       
   159                 stream = open(product_init, 'w')
       
   160                 stream.write(EMPTY_FILE)
       
   161                 stream.close()
       
   162         # manually install included directories if any
   154         # manually install included directories if any
   163         if include_dirs:
   155         if include_dirs:
   164             if subpackage_of:
       
   165                 base = join(subpackage_of, modname)
       
   166             else:
       
   167                 base = modname
       
   168             for directory in include_dirs:
   156             for directory in include_dirs:
   169                 dest = join(self.install_dir, base, directory)
   157                 dest = join(self.install_dir, modname, directory)
   170                 export(directory, dest, verbose=False)
   158                 export(directory, dest, verbose=False)
   171 
   159 
   172 # write required share/cubicweb/cubes/__init__.py
   160 # write required share/cubicweb/cubes/__init__.py
   173 class MyInstallData(install_data.install_data):
   161 class MyInstallData(install_data.install_data):
   174     """A class That manages data files installation"""
   162     """A class That manages data files installation"""
   215         if '--force-manifest' in sys.argv:
   203         if '--force-manifest' in sys.argv:
   216             sys.argv.remove('--force-manifest')
   204             sys.argv.remove('--force-manifest')
   217     # install-layout option was introduced in 2.5.3-1~exp1
   205     # install-layout option was introduced in 2.5.3-1~exp1
   218     elif sys.version_info < (2, 5, 4) and '--install-layout=deb' in sys.argv:
   206     elif sys.version_info < (2, 5, 4) and '--install-layout=deb' in sys.argv:
   219         sys.argv.remove('--install-layout=deb')
   207         sys.argv.remove('--install-layout=deb')
   220     if subpackage_of:
   208     packages = [modname] + get_packages(join(here, modname), modname)
   221         package = subpackage_of + '.' + modname
       
   222         kwargs['package_dir'] = {package : '.'}
       
   223         packages = [package] + get_packages(os.getcwd(), package)
       
   224         if USE_SETUPTOOLS:
       
   225             kwargs['namespace_packages'] = [subpackage_of]
       
   226     else:
       
   227         packages = [modname] + get_packages(join(here, modname), modname)
       
   228     if USE_SETUPTOOLS:
   209     if USE_SETUPTOOLS:
   229         kwargs['install_requires'] = install_requires
   210         kwargs['install_requires'] = install_requires
   230         kwargs['zip_safe'] = False
   211         kwargs['zip_safe'] = False
   231     kwargs['packages'] = packages
   212     kwargs['packages'] = packages
   232     kwargs['package_data'] = package_data
   213     kwargs['package_data'] = package_data