pylint: setup.py
This commit is contained in:
parent
84c7720af5
commit
87dc9c19eb
34
setup.py
34
setup.py
@ -23,12 +23,10 @@
|
|||||||
from glob import glob
|
from glob import glob
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
|
|
||||||
import setuptools
|
import setuptools
|
||||||
from setuptools.command.install import install
|
from setuptools.command.install import install
|
||||||
|
|
||||||
from distutils.command.install_data import install_data
|
|
||||||
from distutils.errors import DistutilsArgError
|
from distutils.errors import DistutilsArgError
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -39,9 +37,9 @@ def is_f(p):
|
|||||||
|
|
||||||
|
|
||||||
INITSYS_FILES = {
|
INITSYS_FILES = {
|
||||||
'sysvinit': filter((lambda x: is_f(x)), glob('sysvinit/*')),
|
'sysvinit': [f for f in glob('sysvinit/*') if is_f(f)],
|
||||||
'systemd': filter((lambda x: is_f(x)), glob('systemd/*')),
|
'systemd': [f for f in glob('systemd/*') if is_f(f)],
|
||||||
'upstart': filter((lambda x: is_f(x)), glob('upstart/*')),
|
'upstart': [f for f in glob('upstart/*') if is_f(f)],
|
||||||
}
|
}
|
||||||
INITSYS_ROOTS = {
|
INITSYS_ROOTS = {
|
||||||
'sysvinit': '/etc/rc.d/init.d',
|
'sysvinit': '/etc/rc.d/init.d',
|
||||||
@ -70,17 +68,18 @@ def tiny_p(cmd, capture=True):
|
|||||||
def get_version():
|
def get_version():
|
||||||
cmd = ['tools/read-version']
|
cmd = ['tools/read-version']
|
||||||
(ver, _e) = tiny_p(cmd)
|
(ver, _e) = tiny_p(cmd)
|
||||||
return ver.strip()
|
return str(ver).strip()
|
||||||
|
|
||||||
|
|
||||||
def read_requires():
|
def read_requires():
|
||||||
cmd = ['tools/read-dependencies']
|
cmd = ['tools/read-dependencies']
|
||||||
(deps, _e) = tiny_p(cmd)
|
(deps, _e) = tiny_p(cmd)
|
||||||
return deps.splitlines()
|
return str(deps).splitlines()
|
||||||
|
|
||||||
|
|
||||||
# TODO: Is there a better way to do this??
|
# TODO: Is there a better way to do this??
|
||||||
class InitsysInstallData(install):
|
class InitsysInstallData(install):
|
||||||
|
init_system = None
|
||||||
user_options = install.user_options + [
|
user_options = install.user_options + [
|
||||||
# This will magically show up in member variable 'init_sys'
|
# This will magically show up in member variable 'init_sys'
|
||||||
('init-system=', None,
|
('init-system=', None,
|
||||||
@ -96,12 +95,11 @@ class InitsysInstallData(install):
|
|||||||
def finalize_options(self):
|
def finalize_options(self):
|
||||||
install.finalize_options(self)
|
install.finalize_options(self)
|
||||||
if self.init_system and self.init_system not in INITSYS_TYPES:
|
if self.init_system and self.init_system not in INITSYS_TYPES:
|
||||||
raise DistutilsArgError(
|
raise DistutilsArgError(("You must specify one of (%s) when"
|
||||||
("You must specify one of (%s) when"
|
" specifying a init system!") % (", ".join(INITSYS_TYPES)))
|
||||||
" specifying a init system!") % (", ".join(INITSYS_TYPES))
|
|
||||||
)
|
|
||||||
elif self.init_system:
|
elif self.init_system:
|
||||||
self.distribution.data_files.append((INITSYS_ROOTS[self.init_system],
|
self.distribution.data_files.append(
|
||||||
|
(INITSYS_ROOTS[self.init_system],
|
||||||
INITSYS_FILES[self.init_system]))
|
INITSYS_FILES[self.init_system]))
|
||||||
# Force that command to reinitalize (with new file list)
|
# Force that command to reinitalize (with new file list)
|
||||||
self.distribution.reinitialize_command('install_data', True)
|
self.distribution.reinitialize_command('install_data', True)
|
||||||
@ -123,10 +121,14 @@ setuptools.setup(name='cloud-init',
|
|||||||
('/etc/cloud/templates', glob('templates/*')),
|
('/etc/cloud/templates', glob('templates/*')),
|
||||||
('/usr/share/cloud-init', []),
|
('/usr/share/cloud-init', []),
|
||||||
('/usr/lib/cloud-init',
|
('/usr/lib/cloud-init',
|
||||||
['tools/uncloud-init', 'tools/write-ssh-key-fingerprints']),
|
['tools/uncloud-init',
|
||||||
('/usr/share/doc/cloud-init', filter(is_f, glob('doc/*'))),
|
'tools/write-ssh-key-fingerprints']),
|
||||||
('/usr/share/doc/cloud-init/examples', filter(is_f, glob('doc/examples/*'))),
|
('/usr/share/doc/cloud-init',
|
||||||
('/usr/share/doc/cloud-init/examples/seed', filter(is_f, glob('doc/examples/seed/*'))),
|
[f for f in glob('doc/*') if is_f(f)]),
|
||||||
|
('/usr/share/doc/cloud-init/examples',
|
||||||
|
[f for f in glob('doc/examples/*') if is_f(f)]),
|
||||||
|
('/usr/share/doc/cloud-init/examples/seed',
|
||||||
|
[f for f in glob('doc/examples/seed/*') if is_f(f)]),
|
||||||
],
|
],
|
||||||
install_requires=read_requires(),
|
install_requires=read_requires(),
|
||||||
cmdclass = {
|
cmdclass = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user