5 from distutils.core import setup
11 version = mic.__version__
12 except (ImportError, AttributeError):
15 # --install-layout is recognized after 2.5
16 if sys.version_info[:2] > (2, 5):
17 if len(sys.argv) > 1 and 'install' in sys.argv:
20 (dist, ver, id) = platform.linux_distribution()
22 # for debian-like distros, mods will be installed to
23 # ${PYTHONLIB}/dist-packages
24 if dist in ('debian', 'Ubuntu'):
25 sys.argv.append('--install-layout=deb')
32 MOD_NAME + '/kickstart',
33 MOD_NAME + '/kickstart/custom_commands',
34 MOD_NAME + '/3rdparty/pykickstart',
35 MOD_NAME + '/3rdparty/pykickstart/commands',
36 MOD_NAME + '/3rdparty/pykickstart/handlers',
37 MOD_NAME + '/3rdparty/pykickstart/urlgrabber',
40 IMAGER_PLUGINS = glob.glob(os.path.join("plugins", "imager", "*.py"))
41 BACKEND_PLUGINS = glob.glob(os.path.join("plugins", "backend", "*.py"))
44 # if real_prefix, it must be in virtualenv, use prefix as root
45 root = sys.prefix if hasattr(sys, 'real_prefix') else ''
47 conffile = 'etc/mic.conf'
48 # apply prefix to mic.conf.in to generate actual mic.conf
49 conf_str = file('etc/mic.conf.in').read()
50 conf_str = conf_str.replace('@PREFIX@', prefix)
51 with file(conffile, 'w') as wf:
56 description = 'Image Creator for Linux Distributions',
57 author='Jian-feng Ding, Qiang Zhang, Gui Chen',
58 author_email='jian-feng.ding@intel.com, qiang.z.zhang@intel.com, gui.chen@intel.com',
59 url='https://github.com/01org/mic',
64 data_files = [("%s/lib/mic/plugins/imager" % prefix, IMAGER_PLUGINS),
65 ("%s/lib/mic/plugins/backend" % prefix, BACKEND_PLUGINS),
66 ("%s/etc/mic" % root, [conffile])]