setup.py
changeset 12255 08628d6d57ee
parent 12254 2060ee44ea9a
child 12256 af1245fe6b7b
equal deleted inserted replaced
12254:2060ee44ea9a 12255:08628d6d57ee
    25 import os
    25 import os
    26 import sys
    26 import sys
    27 from os.path import dirname, exists, isdir, join
    27 from os.path import dirname, exists, isdir, join
    28 
    28 
    29 from setuptools import setup
    29 from setuptools import setup
    30 from distutils.command import install_data
    30 
    31 
    31 
    32 here = dirname(__file__)
    32 here = dirname(__file__)
    33 
    33 
    34 # import required features
    34 # import required features
    35 pkginfo = join(here, 'cubicweb', '__pkginfo__.py')
    35 pkginfo = join(here, 'cubicweb', '__pkginfo__.py')
    68                     result.append(package)
    68                     result.append(package)
    69                 result += get_packages(absfile, result[-1])
    69                 result += get_packages(absfile, result[-1])
    70     return result
    70     return result
    71 
    71 
    72 
    72 
    73 # re-enable copying data files in sys.prefix
       
    74 # overwrite install_data to use sys.prefix instead of the egg directory
       
    75 class MyInstallData(install_data.install_data):
       
    76     """A class that manages data files installation"""
       
    77     def run(self):
       
    78         _old_install_dir = self.install_dir
       
    79         if self.install_dir.endswith('egg'):
       
    80             self.install_dir = sys.prefix
       
    81         install_data.install_data.run(self)
       
    82         self.install_dir = _old_install_dir
       
    83 try:
    73 try:
    84     import setuptools.command.easy_install # only if easy_install available
    74     import setuptools.command.easy_install # only if easy_install available
    85     # monkey patch: Crack SandboxViolation verification
    75     # monkey patch: Crack SandboxViolation verification
    86     from setuptools.sandbox import DirectorySandbox as DS
    76     from setuptools.sandbox import DirectorySandbox as DS
    87     old_ok = DS._ok
    77     old_ok = DS._ok
   163         ],
   153         ],
   164         'zmq': [
   154         'zmq': [
   165             'pyzmq',
   155             'pyzmq',
   166         ],
   156         ],
   167     },
   157     },
   168     cmdclass={
       
   169         'install_data': MyInstallData,
       
   170     },
       
   171     zip_safe=False,
   158     zip_safe=False,
   172 )
   159 )