diff --git a/.gitignore b/.gitignore index 11571660..4a919ea9 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,6 @@ .testrepository *.swp *.pyc +.tox +*.egg-info +dist diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..daceefe7 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,7 @@ +recursive-include lib +include bin/disk-image-create +include bin/disk-image-get-kernel +include bin/ramdisk-image-create +recursive-include elements +include README.md +recursive-include docs diff --git a/babel.cfg b/babel.cfg new file mode 100644 index 00000000..efceab81 --- /dev/null +++ b/babel.cfg @@ -0,0 +1 @@ +[python: **.py] diff --git a/diskimage_builder/elements.py b/diskimage_builder/elements.py index 1029854b..3002a919 100644 --- a/diskimage_builder/elements.py +++ b/diskimage_builder/elements.py @@ -86,6 +86,5 @@ def main(argv): print(' '.join(expand_dependencies(args.elements))) return 0 - sys.stderr.write("ERROR: please choose an option.\n") return -1 diff --git a/diskimage_builder/locale/diskimage_builder.pot b/diskimage_builder/locale/diskimage_builder.pot new file mode 100644 index 00000000..a2f51770 --- /dev/null +++ b/diskimage_builder/locale/diskimage_builder.pot @@ -0,0 +1,20 @@ +# Translations template for configapplier. +# Copyright (C) 2013 ORGANIZATION +# This file is distributed under the same license as the configapplier +# project. +# FIRST AUTHOR , 2013. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: configapplier 0.0.1\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2013-01-24 09:27-0800\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.6\n" + diff --git a/diskimage_builder/locale/en/LC_MESSAGES/diskimage_builder.po b/diskimage_builder/locale/en/LC_MESSAGES/diskimage_builder.po new file mode 100644 index 00000000..8023eed6 --- /dev/null +++ b/diskimage_builder/locale/en/LC_MESSAGES/diskimage_builder.po @@ -0,0 +1,20 @@ +# English translations for configapplier. +# Copyright (C) 2013 ORGANIZATION +# This file is distributed under the same license as the configapplier +# project. +# FIRST AUTHOR , 2013. +# +msgid "" +msgstr "" +"Project-Id-Version: configapplier 0.0.1\n" +"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n" +"POT-Creation-Date: 2013-01-24 09:27-0800\n" +"PO-Revision-Date: 2013-01-24 09:41-0800\n" +"Last-Translator: FULL NAME \n" +"Language-Team: en \n" +"Plural-Forms: nplurals=2; plural=(n != 1)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Generated-By: Babel 0.9.6\n" + diff --git a/diskimage_builder/test_elementdeps.py b/diskimage_builder/test_elementdeps.py index 6cb4a7e5..a62a66f3 100644 --- a/diskimage_builder/test_elementdeps.py +++ b/diskimage_builder/test_elementdeps.py @@ -20,7 +20,9 @@ from fixtures import Fixture, TempDir from diskimage_builder.elements import expand_dependencies -data_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'test-elements')) +data_dir = os.path.abspath( + os.path.join(os.path.dirname(__file__), 'test-elements')) + def _populate_element(element_dir, element_name, element_deps=[]): element_home = os.path.join(element_dir, element_name) @@ -29,6 +31,7 @@ def _populate_element(element_dir, element_name, element_deps=[]): with open(deps_path, 'w') as deps_file: deps_file.write("\n".join(element_deps)) + class TestElementDeps(TestCase): def setUp(self): @@ -45,27 +48,27 @@ class TestElementDeps(TestCase): def test_non_transitive_deps(self): result = expand_dependencies(['requires-foo'], - elements_dir=self.element_dir) + elements_dir=self.element_dir) self.assertEquals(set(['requires-foo', 'foo']), result) def test_transitive_deps(self): result = expand_dependencies(['requires-requires-foo'], - elements_dir=self.element_dir) + elements_dir=self.element_dir) self.assertEquals(set(['requires-requires-foo', 'requires-foo', 'foo']), result) def test_no_deps(self): result = expand_dependencies(['foo'], - elements_dir=self.element_dir) + elements_dir=self.element_dir) self.assertEquals(set(['foo']), result) def test_self(self): result = expand_dependencies(['self'], - elements_dir=self.element_dir) + elements_dir=self.element_dir) self.assertEquals(set(['self']), result) def test_circular(self): result = expand_dependencies(['circular1'], - elements_dir=self.element_dir) + elements_dir=self.element_dir) self.assertEquals(set(['circular1', 'circular2']), result) diff --git a/diskimage_builder/test_elements.py b/diskimage_builder/test_elements.py index 1a626533..1668b8a9 100644 --- a/diskimage_builder/test_elements.py +++ b/diskimage_builder/test_elements.py @@ -17,7 +17,10 @@ import os import sys import unittest -class StubPackage: pass + +class StubPackage: + pass + # conceptually load_tests should be in __init__, but see # http://bugs.python.org/issue16662 instead. So, its here in test_elements.py diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..20daa6e6 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,13 @@ +[extract_messages] +keywords = _ gettext ngettext l_ lazy_gettext +mapping_file = babel.cfg +output_file = diskimage_builder/locale/diskimage_builder.pot + +[update_catalog] +domain = diskimage_builder +output_dir = diskimage_builder/locale +input_file = diskimage_builder/locale/diskimage_builder.pot + +[compile_catalog] +directory = diskimage_builder/locale +domain = diskimage_builder diff --git a/setup.py b/setup.py new file mode 100755 index 00000000..da110c5a --- /dev/null +++ b/setup.py @@ -0,0 +1,40 @@ +#!/usr/bin/python +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import setuptools + +with open("README.md", 'rt') as readme: + readme_text = readme.read() + +setuptools.setup( + name='diskimage_builder', + version='0.0.1', + description="""Build Disk Images for use on OpenStack Nova""", + long_description = readme_text, + license='Apache License (2.0)', + author='HP Cloud Services', + author_email='nobody@hp.com', + url='https://github.com/stackforge/diskimage-builder', + packages=setuptools.find_packages(), + include_package_data=True, + classifiers=[ + 'Development Status :: 3 - Alpha', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 2.7', + 'Environment :: Console', + ], + scripts=['bin/element-info'], + py_modules=[]) diff --git a/tools/test-requires b/tools/test-requires new file mode 100644 index 00000000..0cf0fc18 --- /dev/null +++ b/tools/test-requires @@ -0,0 +1,2 @@ +testtools +fixtures diff --git a/tox.ini b/tox.ini new file mode 100644 index 00000000..ef07a1a4 --- /dev/null +++ b/tox.ini @@ -0,0 +1,43 @@ +[tox] +envlist = py26,py27,pep8 + +[testenv] +setenv = LANG=en_US.UTF-8 + LANGUAGE=en_US:en + LC_ALL=C +deps= + testtools + testrepository + coverage + babel +commands= + bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi' + bash -c 'testr run --parallel {posargs} ; RET=$? echo "Slowest Tests" ; testr slowest && exit $RET' + +[testenv:py26] +deps= + testtools + testrepository + coverage + babel + discover + argparse + +[pep8] +ignore = E125 + +[testenv:pep8] +deps = pep8 +commands = + pep8 --repeat --show-source --exclude=.venv,.tox,doc . + +[testenv:venv] +commands = {posargs} + +[testenv:cover] +setenv = PYTHON=coverage run --source diskimage_builder +commands = bash -c 'if [ ! -d ./.testrepository ] ; then testr init ; fi' + bash -c 'testr run --parallel ; RET=$? ; coverage combine ; coverage html -d ./cover $OMIT && exit $RET' + +[tox:jenkins] +downloadcache = ~/cache/pip