Commit aa499b6c authored by Kai Lautaportti's avatar Kai Lautaportti

Added Python 3.3. support.

parent 2cf107fb
include README.txt include README.txt
include CHANGES.txt include CHANGES.txt
include tox.ini
recursive-include hexagonit * recursive-include hexagonit *
...@@ -208,7 +208,7 @@ Let's create a buildout to build and install the package. ...@@ -208,7 +208,7 @@ Let's create a buildout to build and install the package.
This will download, extract and build our demo package with the This will download, extract and build our demo package with the
default build options. default build options.
>>> print system(buildout) >>> print(system(buildout))
Installing package. Installing package.
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
configure --prefix=/sample_buildout/parts/package configure --prefix=/sample_buildout/parts/package
...@@ -242,7 +242,7 @@ a custom location within the buildout:: ...@@ -242,7 +242,7 @@ a custom location within the buildout::
... url = file://%s/Foo-Bar-0.0.0.tar.gz ... url = file://%s/Foo-Bar-0.0.0.tar.gz
... """ % src) ... """ % src)
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing foobar. Installing foobar.
foobar: Extracting package to /sample_buildout/parts/foobar__compile__ foobar: Extracting package to /sample_buildout/parts/foobar__compile__
...@@ -281,7 +281,7 @@ Makefile and using explicit ``make`` options to control the build process. ...@@ -281,7 +281,7 @@ Makefile and using explicit ``make`` options to control the build process.
... url = file://%s/haproxy-1.4.8-dummy.tar.gz ... url = file://%s/haproxy-1.4.8-dummy.tar.gz
... """ % src) ... """ % src)
>>> print system(buildout) >>> print(system(buildout))
Uninstalling foobar. Uninstalling foobar.
Installing haproxy. Installing haproxy.
haproxy: Extracting package to /sample_buildout/parts/haproxy__compile__ haproxy: Extracting package to /sample_buildout/parts/haproxy__compile__
...@@ -322,7 +322,7 @@ and building that. ...@@ -322,7 +322,7 @@ and building that.
... path = %s/package-0.0.0 ... path = %s/package-0.0.0
... """ % checkout_dir) ... """ % checkout_dir)
>>> print system(buildout) >>> print(system(buildout))
Uninstalling haproxy. Uninstalling haproxy.
Installing package. Installing package.
package: Using local source directory: /checkout/package-0.0.0 package: Using local source directory: /checkout/package-0.0.0
...@@ -379,7 +379,7 @@ This configuration uses custom configure options, an environment section, ...@@ -379,7 +379,7 @@ This configuration uses custom configure options, an environment section,
per-part customization to the environment, custom prefix, multiple make per-part customization to the environment, custom prefix, multiple make
targets and also patches the source code before the scripts are run. targets and also patches the source code before the scripts are run.
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: [ENV] CFLAGS = -I/sw/include package: [ENV] CFLAGS = -I/sw/include
...@@ -464,7 +464,7 @@ and a new buildout to try it out ...@@ -464,7 +464,7 @@ and a new buildout to try it out
... post-make-hook = %(module)s:postmake ... post-make-hook = %(module)s:postmake
... """ % dict(src=src, module='%s/customhandlers.py' % hooks)) ... """ % dict(src=src, module='%s/customhandlers.py' % hooks))
>>> print system(buildout) >>> print(system(buildout))
Uninstalling package. Uninstalling package.
Installing package. Installing package.
package: Extracting package to /sample_buildout/parts/package__compile__ package: Extracting package to /sample_buildout/parts/package__compile__
......
...@@ -95,7 +95,7 @@ class Recipe(object): ...@@ -95,7 +95,7 @@ class Recipe(object):
elif retcode > 0: elif retcode > 0:
log.error('Command failed with exit code %s: %s' % (retcode, cmd)) log.error('Command failed with exit code %s: %s' % (retcode, cmd))
raise zc.buildout.UserError('System error') raise zc.buildout.UserError('System error')
except OSError, e: except OSError as e:
log.error('Command failed: %s: %s' % (e, cmd)) log.error('Command failed: %s: %s' % (e, cmd))
raise zc.buildout.UserError('System error') raise zc.buildout.UserError('System error')
...@@ -148,7 +148,7 @@ class Recipe(object): ...@@ -148,7 +148,7 @@ class Recipe(object):
current_dir = os.getcwd() current_dir = os.getcwd()
try: try:
os.mkdir(self.options['location']) os.mkdir(self.options['location'])
except OSError, e: except OSError as e:
if e.errno == errno.EEXIST: if e.errno == errno.EEXIST:
pass pass
os.chdir(compile_dir) os.chdir(compile_dir)
......
from zope.testing import doctest
from zope.testing import renormalizing from zope.testing import renormalizing
import doctest
import errno import errno
import os import os
import re import re
...@@ -31,7 +30,7 @@ class NonInformativeTests(unittest.TestCase): ...@@ -31,7 +30,7 @@ class NonInformativeTests(unittest.TestCase):
def tearDown(self): def tearDown(self):
shutil.rmtree(self.dir) shutil.rmtree(self.dir)
for var in os.environ.keys(): for var in list(os.environ.keys()):
if var.startswith('HRC_'): if var.startswith('HRC_'):
del os.environ[var] del os.environ[var]
...@@ -48,7 +47,7 @@ class NonInformativeTests(unittest.TestCase): ...@@ -48,7 +47,7 @@ class NonInformativeTests(unittest.TestCase):
parts_directory_path = os.path.join(self.dir, 'test_parts') parts_directory_path = os.path.join(self.dir, 'test_parts')
try: try:
os.mkdir(parts_directory_path) os.mkdir(parts_directory_path)
except OSError, e: except OSError as e:
if e.errno != errno.EEXIST: if e.errno != errno.EEXIST:
raise raise
bo = { bo = {
...@@ -167,7 +166,7 @@ class NonInformativeTests(unittest.TestCase): ...@@ -167,7 +166,7 @@ class NonInformativeTests(unittest.TestCase):
try: try:
recipe.call_script('%s:my_hook' % filename) recipe.call_script('%s:my_hook' % filename)
self.fail("The hook script was not called.") self.fail("The hook script was not called.")
except ValueError, e: except ValueError as e:
self.assertEquals(str(e), 'I got called') self.assertEquals(str(e), 'I got called')
def test_call_script__augmented_environment_as_third_parameter(self): def test_call_script__augmented_environment_as_third_parameter(self):
...@@ -189,7 +188,7 @@ class NonInformativeTests(unittest.TestCase): ...@@ -189,7 +188,7 @@ class NonInformativeTests(unittest.TestCase):
try: try:
recipe.call_script('%s:my_hook' % filename) recipe.call_script('%s:my_hook' % filename)
self.fail("The hook script was not called.") self.fail("The hook script was not called.")
except ValueError, e: except ValueError as e:
self.assertEquals(str(e), 'sentinel bar') self.assertEquals(str(e), 'sentinel bar')
...@@ -211,6 +210,3 @@ def test_suite(): ...@@ -211,6 +210,3 @@ def test_suite():
unittest.makeSuite(NonInformativeTests), unittest.makeSuite(NonInformativeTests),
)) ))
return suite return suite
if __name__ == '__main__':
unittest.main(defaultTest='test_suite')
...@@ -51,6 +51,6 @@ setup( ...@@ -51,6 +51,6 @@ setup(
'test': ['zope.testing'], 'test': ['zope.testing'],
}, },
tests_require=['zope.testing'], tests_require=['zope.testing'],
test_suite='%s.tests.test_suite' % name, test_suite='hexagonit.recipe.cmmi.tests.test_suite',
entry_points={'zc.buildout': ['default = %s:Recipe' % name]}, entry_points={'zc.buildout': ['default = hexagonit.recipe.cmmi:Recipe']},
) )
...@@ -4,9 +4,15 @@ ...@@ -4,9 +4,15 @@
# and then run "tox" from this directory. # and then run "tox" from this directory.
[tox] [tox]
envlist = py26, py27 envlist = py26, py27, py33
[testenv] [testenv]
commands = python setup.py test commands = python setup.py test
deps = deps =
zc.buildout==1.6.3 zc.buildout==1.6.3
[testenv:py33]
deps =
zc.buildout==2.0.0
zope.testing
manuel
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment