summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsylvain thenault <sylvain.thenault@logilab.fr>2009-01-21 09:49:42 +0100
committersylvain thenault <sylvain.thenault@logilab.fr>2009-01-21 09:49:42 +0100
commit7690afc3825e2582934421850d20a922d9370b9a (patch)
treed1bdddff9711f0bdf8e4c142a1c2ffdd8b91d630
parenta85e207cc4a16dcb7ed65c36e7f98ad37564f3f4 (diff)
downloadlogilab-common-7690afc3825e2582934421850d20a922d9370b9a.tar.gz
cleanup
-rw-r--r--setup.py39
1 files changed, 22 insertions, 17 deletions
diff --git a/setup.py b/setup.py
index 7f5bc6a..e85671c 100644
--- a/setup.py
+++ b/setup.py
@@ -2,7 +2,7 @@
# pylint: disable-msg=W0404,W0622,W0704,W0613,W0152
"""Generic Setup script, takes package info from __pkginfo__.py file.
-:copyright: 2003-2008 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+:copyright: 2003-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
:license: General Public License version 2 - http://www.gnu.org/licenses
"""
@@ -15,12 +15,10 @@ from os.path import isdir, exists, join, walk
try:
from setuptools import setup
- from setuptools import command
from setuptools.command import install_lib
USE_SETUPTOOLS = 1
except ImportError:
from distutils.core import setup
- from distutils import command
from distutils.command import install_lib
USE_SETUPTOOLS = 0
@@ -139,20 +137,27 @@ except ImportError:
pass
'''
-class BuildScripts(command.install_lib.install_lib):
-
+class MyInstallLib(install_lib.install_lib):
+ """extend install_lib command to handle package __init__.py and
+ include_dirs variable if necessary
+ """
def run(self):
- command.install_lib.install_lib.run(self)
+ """overridden from install_lib class"""
+ install_lib.install_lib.run(self)
# create Products.__init__.py if needed
- product_init = join(self.install_dir, 'logilab', '__init__.py')
- if not exists(product_init):
- self.announce('creating logilab/__init__.py')
- stream = open(product_init, 'w')
- stream.write(EMPTY_FILE)
- stream.close()
+ if subpackage_of:
+ product_init = join(self.install_dir, subpackage_of, '__init__.py')
+ if not exists(product_init):
+ self.announce('creating %s' % product_init)
+ stream = open(product_init, 'w')
+ stream.write(EMPTY_FILE)
+ stream.close()
# manually install included directories if any
if include_dirs:
- base = join('logilab', modname)
+ if subpackage_of:
+ base = join(subpackage_of, modname)
+ else:
+ base = modname
for directory in include_dirs:
dest = join(self.install_dir, base, directory)
export(directory, dest)
@@ -173,16 +178,16 @@ def install(**kwargs):
kwargs['packages'] = packages
return setup(name = distname,
version = version,
- license =license,
+ license = license,
description = short_desc,
long_description = long_desc,
author = author,
author_email = author_email,
url = web,
scripts = ensure_scripts(scripts),
- data_files=data_files,
- ext_modules=ext_modules,
- cmdclass={'install_lib': BuildScripts},
+ data_files = data_files,
+ ext_modules = ext_modules,
+ cmdclass = {'install_lib': MyInstallLib},
**kwargs
)