diff options
author | Robert Schweikert <rjschwei@suse.com> | 2018-05-29 20:54:19 -0600 |
---|---|---|
committer | Chad Smith <chad.smith@canonical.com> | 2018-05-29 20:54:19 -0600 |
commit | bbcc5e82e6c8e87ca483150205127cb0436c4cd9 (patch) | |
tree | a1fefb52ee9bb9c505d5f114e461becab63519ad /setup.py | |
parent | 4ba4639b86edad7ec89a55a61b7d9075f92d2166 (diff) | |
download | vyos-cloud-init-bbcc5e82e6c8e87ca483150205127cb0436c4cd9.tar.gz vyos-cloud-init-bbcc5e82e6c8e87ca483150205127cb0436c4cd9.zip |
util: add get_linux_distro function to replace platform.dist
Allow the user to set the distribution with --distro argument to setup.py.
Fall back is to read /etc/os-release. Final backup is to use
platform.dist() Python function. The platform.dist() function is
deprecated and will be removed in Python 3.7
LP: #1745235
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -25,7 +25,7 @@ from distutils.errors import DistutilsArgError import subprocess RENDERED_TMPD_PREFIX = "RENDERED_TEMPD" - +VARIANT = None def is_f(p): return os.path.isfile(p) @@ -114,10 +114,20 @@ def render_tmpl(template): atexit.register(shutil.rmtree, tmpd) bname = os.path.basename(template).rstrip(tmpl_ext) fpath = os.path.join(tmpd, bname) - tiny_p([sys.executable, './tools/render-cloudcfg', template, fpath]) + if VARIANT: + tiny_p([sys.executable, './tools/render-cloudcfg', '--variant', + VARIANT, template, fpath]) + else: + tiny_p([sys.executable, './tools/render-cloudcfg', template, fpath]) # return path relative to setup.py return os.path.join(os.path.basename(tmpd), bname) +# User can set the variant for template rendering +if '--distro' in sys.argv: + idx = sys.argv.index('--distro') + VARIANT = sys.argv[idx+1] + del sys.argv[idx+1] + sys.argv.remove('--distro') INITSYS_FILES = { 'sysvinit': [f for f in glob('sysvinit/redhat/*') if is_f(f)], @@ -260,7 +270,7 @@ requirements = read_requires() setuptools.setup( name='cloud-init', version=get_version(), - description='EC2 initialisation magic', + description='Cloud instance initialisation magic', author='Scott Moser', author_email='scott.moser@canonical.com', url='http://launchpad.net/cloud-init/', @@ -277,4 +287,5 @@ setuptools.setup( } ) + # vi: ts=4 expandtab |