summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorHuanhuan Li <huanhuanx.li@intel.com>2014-04-21 14:52:55 +0800
committeradmin <yuhuan.yang@samsung.com>2016-02-04 17:44:53 +0800
commit431ade1a7f83347f8498dabcfbb7629a40564924 (patch)
tree6759a1386769cf10fb056863366f0df81672e79d /setup.py
parentb53a557d7d1633b773955b708f26e29f39a92a96 (diff)
downloadmic-431ade1a7f83347f8498dabcfbb7629a40564924.tar.gz
mic-431ade1a7f83347f8498dabcfbb7629a40564924.tar.bz2
mic-431ade1a7f83347f8498dabcfbb7629a40564924.zip
Fix pylint tips
Change-Id: Ic0805cc13abc16afd1881c7513edf2f9f980d0fc C: 58,0: Line too long (87/80) W: 20,24: Redefining built-in 'id' C: 1,0: Missing docstring C: 11,4: Invalid name "version" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 13,4: Invalid name "version" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) W: 26,8: No exception type(s) specified C: 20,13: Invalid name "dist" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 20,19: Invalid name "ver" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 20,24: Invalid name "id" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 43,0: Invalid name "prefix" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 45,0: Invalid name "root" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 47,0: Invalid name "conffile" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 49,0: Invalid name "conf_str" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$) C: 50,0: Invalid name "conf_str" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py73
1 files changed, 44 insertions, 29 deletions
diff --git a/setup.py b/setup.py
index da3b0b2..3de7519 100644
--- a/setup.py
+++ b/setup.py
@@ -1,30 +1,48 @@
#!/usr/bin/env python
+"""
+ Main for installing mic
+"""
+
import os, sys
import glob
from distutils.core import setup
+
MOD_NAME = 'mic'
+
+def check_debian():
+ """--install-layout is recognized after 2.5"""
+ if sys.version_info[:2] > (2, 5):
+ if len(sys.argv) > 1 and 'install' in sys.argv:
+ try:
+ import platform
+ (dist, _, _) = platform.linux_distribution()
+ # for debian-like distros, mods will be installed to
+ # ${PYTHONLIB}/dist-packages
+ if dist in ('debian', 'Ubuntu'):
+ sys.argv.append('--install-layout=deb')
+ except AttributeError:
+ pass
+
+
+def create_conf_file():
+ """Apply prefix to mic.conf.in to generate actual mic.conf"""
+ with open('etc/mic.conf.in') as source_file:
+ conf_str = source_file.read()
+ conf_str = conf_str.replace('@PREFIX@', PREFIX)
+ with open(CONF_FILE, 'w') as conf_file:
+ conf_file.write(conf_str)
+
+
try:
import mic
- version = mic.__version__
+ VERSION = mic.__version__
except (ImportError, AttributeError):
- version = "dev"
-
-# --install-layout is recognized after 2.5
-if sys.version_info[:2] > (2, 5):
- if len(sys.argv) > 1 and 'install' in sys.argv:
- try:
- import platform
- (dist, ver, id) = platform.linux_distribution()
-
- # for debian-like distros, mods will be installed to
- # ${PYTHONLIB}/dist-packages
- if dist in ('debian', 'Ubuntu'):
- sys.argv.append('--install-layout=deb')
- except:
- pass
+ VERSION = "dev"
+
+check_debian()
PACKAGES = [MOD_NAME,
MOD_NAME + '/utils',
@@ -40,28 +58,25 @@ PACKAGES = [MOD_NAME,
IMAGER_PLUGINS = glob.glob(os.path.join("plugins", "imager", "*.py"))
BACKEND_PLUGINS = glob.glob(os.path.join("plugins", "backend", "*.py"))
-prefix = sys.prefix
+PREFIX = sys.prefix
# if real_prefix, it must be in virtualenv, use prefix as root
-root = sys.prefix if hasattr(sys, 'real_prefix') else ''
+ROOT = sys.prefix if hasattr(sys, 'real_prefix') else ''
-conffile = 'etc/mic.conf'
-# apply prefix to mic.conf.in to generate actual mic.conf
-conf_str = file('etc/mic.conf.in').read()
-conf_str = conf_str.replace('@PREFIX@', prefix)
-with file(conffile, 'w') as wf:
- wf.write(conf_str)
+CONF_FILE = 'etc/mic.conf'
+create_conf_file()
setup(name=MOD_NAME,
- version = version,
+ version = VERSION,
description = 'Image Creator for Linux Distributions',
author='Jian-feng Ding, Qiang Zhang, Gui Chen',
- author_email='jian-feng.ding@intel.com, qiang.z.zhang@intel.com, gui.chen@intel.com',
+ author_email='jian-feng.ding@intel.com, qiang.z.zhang@intel.com,\
+ gui.chen@intel.com',
url='https://github.com/01org/mic',
scripts=[
'tools/mic',
],
packages = PACKAGES,
- data_files = [("%s/lib/mic/plugins/imager" % prefix, IMAGER_PLUGINS),
- ("%s/lib/mic/plugins/backend" % prefix, BACKEND_PLUGINS),
- ("%s/etc/mic" % root, [conffile])]
+ data_files = [("%s/lib/mic/plugins/imager" % PREFIX, IMAGER_PLUGINS),
+ ("%s/lib/mic/plugins/backend" % PREFIX, BACKEND_PLUGINS),
+ ("%s/etc/mic" % ROOT, [CONF_FILE])]
)