summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-11-25 11:46:10 -0800
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-11-25 11:46:10 -0800
commit7b39b3976f94fd9ce9cbe39324ec14ad5a7c334e (patch)
tree0ebb51599a0024b2507811697bfe965e66ac29e1 /setup.py
parent7d20f3843bff0069b1ac9b2f0c6d346889789058 (diff)
parent1db41a6f5283d38dff6de0b0421d51eac869a39c (diff)
downloadvyos-cloud-init-7b39b3976f94fd9ce9cbe39324ec14ad5a7c334e.tar.gz
vyos-cloud-init-7b39b3976f94fd9ce9cbe39324ec14ad5a7c334e.zip
Update with trunk and resolve conflicts
Diffstat (limited to 'setup.py')
-rwxr-xr-xsetup.py55
1 files changed, 37 insertions, 18 deletions
diff --git a/setup.py b/setup.py
index 3b0af03c..ab72ec18 100755
--- a/setup.py
+++ b/setup.py
@@ -23,6 +23,7 @@
from glob import glob
import os
+import sys
import setuptools
from setuptools.command.install import install
@@ -90,6 +91,17 @@ elif os.path.isfile('/etc/redhat-release'):
USR_LIB_EXEC = "/usr/libexec"
+# Avoid having datafiles installed in a virtualenv...
+def in_virtualenv():
+ try:
+ if sys.real_prefix == sys.prefix:
+ return False
+ else:
+ return True
+ except AttributeError:
+ return False
+
+
def get_version():
cmd = ['tools/read-version']
(ver, _e) = tiny_p(cmd)
@@ -139,6 +151,29 @@ class InitsysInstallData(install):
self.distribution.reinitialize_command('install_data', True)
+if in_virtualenv():
+ data_files = []
+ cmdclass = {}
+else:
+ data_files = [
+ (ETC + '/cloud', glob('config/*.cfg')),
+ (ETC + '/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')),
+ (ETC + '/cloud/templates', glob('templates/*')),
+ (USR_LIB_EXEC + '/cloud-init', ['tools/uncloud-init',
+ 'tools/write-ssh-key-fingerprints']),
+ (USR + '/share/doc/cloud-init', [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)]),
+ ]
+ # Use a subclass for install that handles
+ # adding on the right init system configuration files
+ cmdclass = {
+ 'install': InitsysInstallData,
+ }
+
+
setuptools.setup(name='cloud-init',
version=get_version(),
description='EC2 initialisation magic',
@@ -150,23 +185,7 @@ setuptools.setup(name='cloud-init',
'tools/cloud-init-per',
],
license='GPLv3',
- data_files=[(ETC + '/cloud', glob('config/*.cfg')),
- (ETC + '/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')),
- (ETC + '/cloud/templates', glob('templates/*')),
- (USR_LIB_EXEC + '/cloud-init',
- ['tools/uncloud-init',
- 'tools/write-ssh-key-fingerprints']),
- (USR + '/share/doc/cloud-init',
- [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)]),
- ],
+ data_files=data_files,
install_requires=read_requires(),
- cmdclass={
- # Use a subclass for install that handles
- # adding on the right init system configuration files
- 'install': InitsysInstallData,
- },
+ cmdclass=cmdclass,
)