From ee4a174e2e3b3268ef95485b99d81edea1ca3458 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 21 Jan 2015 15:14:24 -0500 Subject: * Added a simple tox.ini file * Use universal_newlines in setup.py so it will work properly in Python 3. * Fix a pyflakes complaint in setup.py * Add a simple MANIFEST.in --- setup.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 25f09e58..507d5b25 100755 --- a/setup.py +++ b/setup.py @@ -45,7 +45,8 @@ def tiny_p(cmd, capture=True): stdout = None stderr = None sp = subprocess.Popen(cmd, stdout=stdout, - stderr=stderr, stdin=None) + stderr=stderr, stdin=None, + universal_newlines=True) (out, err) = sp.communicate() ret = sp.returncode if ret not in [0]: @@ -144,9 +145,9 @@ class InitsysInstallData(install): raise DistutilsArgError( "Invalid --init-system: %s" % (','.join(bad))) - for sys in self.init_system: + for system in self.init_system: self.distribution.data_files.append( - (INITSYS_ROOTS[sys], INITSYS_FILES[sys])) + (INITSYS_ROOTS[system], INITSYS_FILES[system])) # Force that command to reinitalize (with new file list) self.distribution.reinitialize_command('install_data', True) -- cgit v1.2.3 From 463d626ba53e54160f350d84831e1877b24f4024 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 21 Jan 2015 15:28:32 -0500 Subject: Only install cheetah (and only run the cheetah templating test) when in Python 2. Cheetah is not compatible with Python 3. --- requirements.txt | 4 +++- setup.py | 7 ++++++- tests/unittests/test_templating.py | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'setup.py') diff --git a/requirements.txt b/requirements.txt index 943dbef7..2a12ca3e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ # Pypi requirements for cloud-init to work # Used for untemplating any files or strings with parameters. -cheetah jinja2 # This is used for any pretty printing of tabular data. @@ -32,3 +31,6 @@ requests # For patching pieces of cloud-config together jsonpatch + +# For Python 2/3 compatibility +six diff --git a/setup.py b/setup.py index 507d5b25..e88d9e88 100755 --- a/setup.py +++ b/setup.py @@ -175,6 +175,11 @@ else: } +requirements = read_requires() +if sys.version_info < (3,): + requirements.append('cheetah') + + setuptools.setup(name='cloud-init', version=get_version(), description='EC2 initialisation magic', @@ -187,6 +192,6 @@ setuptools.setup(name='cloud-init', ], license='GPLv3', data_files=data_files, - install_requires=read_requires(), + install_requires=requirements, cmdclass=cmdclass, ) diff --git a/tests/unittests/test_templating.py b/tests/unittests/test_templating.py index 3ba4ed8a..957467f6 100644 --- a/tests/unittests/test_templating.py +++ b/tests/unittests/test_templating.py @@ -16,6 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +import six +import unittest + from . import helpers as test_helpers import textwrap @@ -38,6 +41,7 @@ class TestTemplates(test_helpers.TestCase): out_data = templater.basic_render(in_data, {'b': 2}) self.assertEqual(expected_data.strip(), out_data) + @unittest.skipIf(six.PY3, 'Cheetah is not compatible with Python 3') def test_detection(self): blob = "## template:cheetah" -- cgit v1.2.3