From a09bcfe59fb3b2ccca1102177361449b6b193ae0 Mon Sep 17 00:00:00 2001 From: JF Ding Date: Thu, 1 Sep 2011 11:32:38 +0900 Subject: update setup.py for ubuntu installation and open the 'develop' cmd by using setuptools --- setup.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 475d719..cdfefae 100644 --- a/setup.py +++ b/setup.py @@ -3,11 +3,11 @@ import os, sys import glob from distutils.core import setup -#try: -# import setuptools -# # enable "setup.py develop", optional -#except ImportError: -# pass +try: + import setuptools + # enable "setup.py develop", optional +except ImportError: + pass MOD_NAME = 'mic' @@ -30,6 +30,22 @@ except IOError: print 'WARNING: Cannot write version number file' pass +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' + + 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') + PACKAGES = [MOD_NAME, MOD_NAME + '/utils', MOD_NAME + '/imager', -- cgit v1.2.3