setup.py
changeset 11737 47e516587460
parent 11685 6c263b8091d3
child 11752 8c45f52b76e4
equal deleted inserted replaced
11736:b77c82355325 11737:47e516587460
    26 import sys
    26 import sys
    27 import shutil
    27 import shutil
    28 from os.path import dirname, exists, isdir, join
    28 from os.path import dirname, exists, isdir, join
    29 
    29 
    30 from setuptools import setup
    30 from setuptools import setup
    31 from setuptools.command import install_lib
    31 from setuptools.command import develop, install_lib
    32 from distutils.command import install_data
    32 from distutils.command import install_data
    33 
    33 
    34 here = dirname(__file__)
    34 here = dirname(__file__)
    35 
    35 
    36 # import required features
    36 # import required features
   158         path = join(self.install_dir, 'share', 'cubicweb', 'cubes', '__init__.py')
   158         path = join(self.install_dir, 'share', 'cubicweb', 'cubes', '__init__.py')
   159         ini = open(path, 'w')
   159         ini = open(path, 'w')
   160         ini.write('# Cubicweb cubes directory\n')
   160         ini.write('# Cubicweb cubes directory\n')
   161         ini.close()
   161         ini.close()
   162 
   162 
       
   163 
       
   164 class CWDevelop(develop.develop):
       
   165     """Custom "develop" command warning about (legacy) cubes directory not
       
   166     installed.
       
   167     """
       
   168 
       
   169     def run(self):
       
   170         cubespath = join(sys.prefix, 'share', 'cubicweb', 'cubes')
       
   171         self.warn('develop command does not install (legacy) cubes directory (%s)'
       
   172                   % cubespath)
       
   173         return super(CWDevelop, self).run()
       
   174 
       
   175 
   163 # re-enable copying data files in sys.prefix
   176 # re-enable copying data files in sys.prefix
   164 # overwrite MyInstallData to use sys.prefix instead of the egg directory
   177 # overwrite MyInstallData to use sys.prefix instead of the egg directory
   165 MyInstallMoreData = MyInstallData
   178 MyInstallMoreData = MyInstallData
   166 class MyInstallData(MyInstallMoreData): # pylint: disable=E0102
   179 class MyInstallData(MyInstallMoreData): # pylint: disable=E0102
   167     """A class that manages data files installation"""
   180     """A class that manages data files installation"""
   245         ],
   258         ],
   246         'zmq': [
   259         'zmq': [
   247             'pyzmq',
   260             'pyzmq',
   248         ],
   261         ],
   249     },
   262     },
   250     cmdclass={'install_lib': MyInstallLib,
   263     cmdclass={
   251               'install_data': MyInstallData},
   264         'install_lib': MyInstallLib,
       
   265         'install_data': MyInstallData,
       
   266         'develop': CWDevelop,
       
   267     },
   252     zip_safe=False,
   268     zip_safe=False,
   253 )
   269 )