diff options
author | Gui Chen <gui.chen@intel.com> | 2011-11-03 18:23:36 +0800 |
---|---|---|
committer | Gui Chen <gui.chen@intel.com> | 2011-11-03 19:55:52 +0800 |
commit | 22b936ca093e5e37aa89ea9c7d1cb9dd40115bd4 (patch) | |
tree | 9366a48f00452738103752be05f33d899d43553c /setup.py | |
parent | 78d72b511bfee1fe4bbfb96cfd37b95491d70812 (diff) | |
download | mic-22b936ca093e5e37aa89ea9c7d1cb9dd40115bd4.tar.gz mic-22b936ca093e5e37aa89ea9c7d1cb9dd40115bd4.tar.bz2 mic-22b936ca093e5e37aa89ea9c7d1cb9dd40115bd4.zip |
setup.py: replace lsb_release to platform and replace list-all-py to glob
platform is more effective to detect the distro type, and glob is easier than list all python file
Signed-off-by: Gui Chen <gui.chen@intel.com>
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 36 |
1 files changed, 15 insertions, 21 deletions
@@ -30,21 +30,19 @@ except IOError: print 'WARNING: Cannot write version number file' pass +# --install-layout is recognized after 2.5 if sys.version_info[:2] > (2, 5): if len(sys.argv) > 1 and 'install' in sys.argv: - lsbcmd = None - if os.path.exists('/usr/bin/lsb_release'): - lsbcmd = '/usr/bin/lsb_release' - elif os.path.exists('/bin/lsb_release'): - lsbcmd = '/bin/lsb_release' + dist=None + import platform + try: + (dist, ver, id) = platform.linux_distribution() + except: + pass - if lsbcmd: - import subprocess - res = subprocess.Popen([lsbcmd, '-i'], - stdout=subprocess.PIPE - ).communicate()[0] - if 'Debian' in res or 'Ubuntu' in res: - sys.argv.append('--install-layout=deb') + # for debian-like distros, set deb-layout py-lib + if dist in ('debian', 'Ubuntu'): + sys.argv.append('--install-layout=deb') PACKAGES = [MOD_NAME, MOD_NAME + '/utils', @@ -57,6 +55,9 @@ PACKAGES = [MOD_NAME, MOD_NAME + '/3rdparty/pykickstart/urlgrabber', ] +IMAGER_PLUGINS = glob.glob(os.path.join("plugins", "imager", "*.py")) +BACKEND_PLUGINS = glob.glob(os.path.join("plugins", "backend", "*.py")) + setup(name=MOD_NAME, version = version, description = 'New MeeGo Image Creator', @@ -67,15 +68,8 @@ setup(name=MOD_NAME, 'tools/mic', ], packages = PACKAGES, - data_files = [("/usr/lib/mic/plugins/imager", ["plugins/imager/fs_plugin.py", - "plugins/imager/livecd_plugin.py", - "plugins/imager/liveusb_plugin.py", - "plugins/imager/loop_plugin.py", - "plugins/imager/raw_plugin.py", - ]), - ("/usr/lib/mic/plugins/backend", ["plugins/backend/zypppkgmgr.py", - "plugins/backend/yumpkgmgr.py", - ]), + data_files = [("/usr/lib/mic/plugins/imager", IMAGER_PLUGINS), + ("/usr/lib/mic/plugins/backend", BACKEND_PLUGINS), ("/etc/mic", ["distfiles/mic.conf"])] ) |