equal
deleted
inserted
replaced
29 try: |
29 try: |
30 if os.environ.get('NO_SETUPTOOLS'): |
30 if os.environ.get('NO_SETUPTOOLS'): |
31 raise ImportError() # do as there is no setuptools |
31 raise ImportError() # do as there is no setuptools |
32 from setuptools import setup |
32 from setuptools import setup |
33 from setuptools.command import install_lib |
33 from setuptools.command import install_lib |
|
34 from setuptools.command import install_data |
34 USE_SETUPTOOLS = True |
35 USE_SETUPTOOLS = True |
35 except ImportError: |
36 except ImportError: |
36 from distutils.core import setup |
37 from distutils.core import setup |
37 from distutils.command import install_lib |
38 from distutils.command import install_lib |
|
39 from distutils.command import install_data |
38 USE_SETUPTOOLS = False |
40 USE_SETUPTOOLS = False |
39 |
41 |
40 # import required features |
42 # import required features |
41 from __pkginfo__ import modname, version, license, description, web, \ |
43 from __pkginfo__ import modname, version, license, description, web, \ |
42 author, author_email |
44 author, author_email |
161 base = modname |
163 base = modname |
162 for directory in include_dirs: |
164 for directory in include_dirs: |
163 dest = join(self.install_dir, base, directory) |
165 dest = join(self.install_dir, base, directory) |
164 export(directory, dest, verbose=False) |
166 export(directory, dest, verbose=False) |
165 |
167 |
|
168 class MyInstallData(install_data.install_data): |
|
169 def run(self): |
|
170 """overridden from install_data class""" |
|
171 install_data.install_data.run(self) |
|
172 path = join(self.install_dir, 'share', 'cubicweb', 'cubes', '__init__.py') |
|
173 ini = open(path, 'w') |
|
174 ini.write('# Cubicweb cubes directory\n') |
|
175 ini.close() |
|
176 |
|
177 |
166 def install(**kwargs): |
178 def install(**kwargs): |
167 """setup entry point""" |
179 """setup entry point""" |
168 if USE_SETUPTOOLS: |
180 if USE_SETUPTOOLS: |
169 if '--force-manifest' in sys.argv: |
181 if '--force-manifest' in sys.argv: |
170 sys.argv.remove('--force-manifest') |
182 sys.argv.remove('--force-manifest') |
186 return setup(name=distname, version=version, license=license, url=web, |
198 return setup(name=distname, version=version, license=license, url=web, |
187 description=description, long_description=long_description, |
199 description=description, long_description=long_description, |
188 author=author, author_email=author_email, |
200 author=author, author_email=author_email, |
189 scripts=ensure_scripts(scripts), data_files=data_files, |
201 scripts=ensure_scripts(scripts), data_files=data_files, |
190 ext_modules=ext_modules, |
202 ext_modules=ext_modules, |
191 cmdclass={'install_lib': MyInstallLib}, |
203 cmdclass={'install_lib': MyInstallLib, 'install_data': MyInstallData}, |
192 **kwargs |
204 **kwargs |
193 ) |
205 ) |
194 |
206 |
195 if __name__ == '__main__' : |
207 if __name__ == '__main__' : |
196 install() |
208 install() |