Skip to content

Commit

Permalink
Merge 4a22e04 into 90601b4
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed May 25, 2017
2 parents 90601b4 + 4a22e04 commit 0db88c2
Show file tree
Hide file tree
Showing 17 changed files with 278 additions and 169 deletions.
8 changes: 8 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[run]
source = src

[report]
exclude_lines =
pragma: no cover
if __name__ == '__main__':
raise NotImplementedError
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
language: python
sudo: false
python:
- 2.7
- 3.4
- 3.5
- 3.6
- pypy-5.4.1
script:
# Coverage slows this old pypy down to several minutes
- if [[ $TRAVIS_PYTHON_VERSION == pypy* ]]; then zope-testrunner --test-path=src; fi
- if [[ $TRAVIS_PYTHON_VERSION != pypy* ]]; then coverage run -m zope.testrunner --test-path=src; fi

after_success:
- coveralls
notifications:
email: false

install:
- pip install -U pip setuptools
- pip install -U coveralls coverage
- pip install -U -e ".[test]"


cache: pip

before_cache:
- rm -f $HOME/.cache/pip/log/debug.log
6 changes: 5 additions & 1 deletion CHANGES.txt → CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
Release History
***************

1.4.0 (unreleased)
2.0.0 (unreleased)
==================

- Add support for Python 3.4, 3.5, 3.6 and PyPy.

- Automated testing is enabled on Travis CI.

1.3.6 (2014-04-14)
==================

Expand Down
9 changes: 9 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
include *.rst
include *.txt
include buildout.cfg
include .travis.yml
include tox.ini
include .coveragerc
include test_all_pythons.cfg
recursive-include src *.rst
recursive-include src *.txt
File renamed without changes.
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[bdist_wheel]
universal = 1
80 changes: 52 additions & 28 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,46 @@
from setuptools import setup, find_packages

def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
with open(os.path.join(os.path.dirname(__file__), *rnames)) as f:
return f.read()

name = "zc.recipe.cmmi"
name="zc.recipe.cmmi"
setup(
name = name,
version='1.4dev',
author = "Jim Fulton",
author_email = "jim@zope.com",
description = "ZC Buildout recipe for configure/make/make install",
license = "ZPL 2.1",
keywords = "zc.buildout buildout recipe cmmi configure make install",
classifiers = [
name=name,
version='2.0.dev0',
author="Jim Fulton",
author_email="jim@zope.com",
description="ZC Buildout recipe for configure/make/make install",
license="ZPL 2.1",
keywords="zc.buildout buildout recipe cmmi configure make install",
classifiers=[
"Environment :: Plugins",
"Framework :: Buildout",
"Intended Audience :: Developers",
"License :: OSI Approved :: Zope Public License",
"Topic :: Software Development :: Build Tools",
"Topic :: System :: Software Distribution",
],
url='http://pypi.python.org/pypi/'+name,
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Natural Language :: English',
'Operating System :: OS Independent',
],
url='http://github.com/zopefoundation/' + name,
long_description=(
read('README.txt')
read('README.rst')
+ '\n' +
read('CHANGES.txt')
read('CHANGES.rst')
+ '\n' +
'Detailed Documentation\n'
'**********************\n'
+ '\n' +
read('src', 'zc', 'recipe', 'cmmi', 'README.txt')
read('src', 'zc', 'recipe', 'cmmi', 'README.rst')
+ '\n' +
'Download Cache\n'
'**************\n'
Expand All @@ -53,16 +64,29 @@ def read(*rnames):
+ '\n' +
'Download\n'
'**********************\n'
),

package_dir = {'':'src'},
packages = find_packages('src'),
include_package_data = True,
data_files = [('.', ['README.txt'])],
namespace_packages = ['zc', 'zc.recipe'],
install_requires = ['zc.buildout >=1.4', 'setuptools'],
extras_require = dict(test=['zope.testing']),
entry_points = {'zc.buildout':
['default = %s:Recipe' % name]},
zip_safe = True,
)
),
package_dir={'':'src'},
packages=find_packages('src'),
include_package_data=True,
namespace_packages=['zc', 'zc.recipe'],
install_requires=[
'zc.buildout >= 1.4',
'setuptools'],
extras_require={
'test': [
# sadly zc.buildout doesn't have a test extra, so we
# need to duplicate its test dependencies, since we import its
# test package.
'zc.buildout[test]',
'manuel',
'zope.testing',
'zope.testrunner',
],
},
entry_points={
'zc.buildout': [
'default = %s:Recipe' % name
],
},
zip_safe=True,
)
2 changes: 1 addition & 1 deletion src/zc/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
2 changes: 1 addition & 1 deletion src/zc/recipe/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__import__('pkg_resources').declare_namespace(__name__)
__import__('pkg_resources').declare_namespace(__name__) # pragma: no cover
59 changes: 30 additions & 29 deletions src/zc/recipe/cmmi/README.txt → src/zc/recipe/cmmi/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ We used the url option to specify the location of the archive.
If we run the buildout, the configure script in the archive is run.
It creates a make file which is also run:

>>> print system('bin/buildout'),
>>> print(system('bin/buildout').strip())
Installing foo.
foo: Downloading http://localhost/foo.tgz
foo: Unpacking and configuring
Expand All @@ -44,7 +44,7 @@ The recipe also creates the parts directory:
If we run the buildout again, the update method will be called, which
does nothing:

>>> print system('bin/buildout'),
>>> print(system('bin/buildout').strip())
Updating foo.

You can supply extra configure options:
Expand All @@ -60,7 +60,7 @@ You can supply extra configure options:
... extra_options = -a -b c
... """ % distros_url)

>>> print system('bin/buildout'),
>>> print(system('bin/buildout').strip())
Uninstalling foo.
Installing foo.
foo: Downloading http://localhost/foo.tgz
Expand All @@ -75,17 +75,14 @@ The recipe sets the location option, which can be read by other
recipes, to the location where the part is installed:

>>> cat('.installed.cfg')
... # doctest: +ELLIPSIS
[buildout]
installed_develop_eggs =
installed_develop_eggs =
parts = foo
<BLANKLINE>
[foo]
__buildout_installed__ = /sample_buildout/parts/foo
...
extra_options = -a -b c
...
location = /sample_buildout/parts/foo
...
...

It may be necessary to set some environment variables when running configure
or make. This can be done by adding an environment statement:
Expand All @@ -103,7 +100,7 @@ or make. This can be done by adding an environment statement:
... """ % distros_url)


>>> print system('bin/buildout'),
>>> print(system('bin/buildout').strip())
Uninstalling foo.
Installing foo.
foo: Downloading http://localhost/foo.tgz
Expand All @@ -128,8 +125,8 @@ First of all let's write a patchfile:
... @@ -1,13 +1,13 @@
... #!%s
... import sys
... -print "configuring foo", ' '.join(sys.argv[1:])
... +print "configuring foo patched", ' '.join(sys.argv[1:])
... -print("configuring foo " + ' '.join(sys.argv[1:]))
... +print("configuring foo patched " + ' '.join(sys.argv[1:]))
...
... Makefile_template = '''
... all:
Expand All @@ -141,7 +138,8 @@ First of all let's write a patchfile:
... +\techo installing foo patched
... '''
...
... open('Makefile', 'w').write(Makefile_template)
... with open('Makefile', 'w') as f:
... _ = f.write(Makefile_template)
...
... """ % sys.executable)

Expand All @@ -160,12 +158,13 @@ passed, -p0 is appended by default.
... patch_options = -p0
... """ % distros_url)

>>> print system('bin/buildout'),
>>> print(system('bin/buildout').strip())
Uninstalling foo.
Installing foo.
foo: Downloading http://localhost/foo.tgz
foo: Unpacking and configuring
patching file configure
...
configuring foo patched --prefix=/sample_buildout/parts/foo
echo building foo patched
building foo patched
Expand All @@ -185,7 +184,7 @@ It is possible to autogenerate the configure files:
... autogen = autogen.sh
... """ % distros_url)

>>> print system('bin/buildout'),
>>> print(system('bin/buildout').strip())
Uninstalling foo.
Installing foo.
foo: Downloading http://localhost//bar.tgz
Expand Down Expand Up @@ -213,7 +212,7 @@ It is also possible to support configure commands other than "./configure":
... --bindir=bin
... """ % distros_url)

>>> print system('bin/buildout'),
>>> print(system('bin/buildout').strip())
Uninstalling foo.
Installing foo.
foo: Downloading http://localhost//baz.tgz
Expand All @@ -228,9 +227,9 @@ When downloading a source archive or a patch, we can optionally make sure of
its authenticity by supplying an MD5 checksum that must be matched. If it
matches, we'll not be bothered with the check by buildout's output:

>>> try: from hashlib import md5
... except ImportError: from md5 import new as md5
>>> foo_md5sum = md5(open(join(distros, 'foo.tgz')).read()).hexdigest()
>>> from hashlib import md5
>>> with open(join(distros, 'foo.tgz'), 'rb') as f:
... foo_md5sum = md5(f.read()).hexdigest()

>>> write('buildout.cfg',
... """
Expand All @@ -243,7 +242,7 @@ matches, we'll not be bothered with the check by buildout's output:
... md5sum = %s
... """ % (distros_url, foo_md5sum))

>>> print system('bin/buildout'),
>>> print(system('bin/buildout').strip())
Uninstalling foo.
Installing foo.
foo: Downloading http://localhost/foo.tgz
Expand All @@ -268,7 +267,7 @@ But if the archive doesn't match the checksum, the recipe refuses to install:
... patch = ${buildout:directory}/patches/config.patch
... """ % (distros_url, foo_md5sum))

>>> print system('bin/buildout'),
>>> print(system('bin/buildout').strip())
Uninstalling foo.
Installing foo.
foo: Downloading http://localhost:20617/bar.tgz
Expand All @@ -291,7 +290,7 @@ aborted:
... patch-md5sum = %s
... """ % (distros_url, foo_md5sum))

>>> print system('bin/buildout'),
>>> print(system('bin/buildout').strip())
Installing foo.
foo: Downloading http://localhost:21669/foo.tgz
foo: Unpacking and configuring
Expand All @@ -316,7 +315,7 @@ is logged to stdout, and left intact for debugging purposes.
>>> write('patches/config.patch', "dgdgdfgdfg")

>>> res = system('bin/buildout')
>>> print res
>>> print(res)
Installing foo.
foo: Downloading http://localhost/foo.tgz
foo: Unpacking and configuring
Expand All @@ -329,7 +328,7 @@ is logged to stdout, and left intact for debugging purposes.
An internal error occurred due to a bug in either zc.buildout or in a
recipe being used:
...
SystemError: ('Failed', 'patch -p0 < /.../patches/config.patch')
CalledProcessError: Command 'patch -p0 < ...' returned non-zero exit status ...
<BLANKLINE>

>>> import re
Expand All @@ -345,8 +344,9 @@ After a successful build, such temporary directories are removed.
>>> import glob
>>> import tempfile

>>> tempdir = tempfile.gettempdir()
>>> dirs = len(glob.glob(os.path.join(tempdir, '*buildout-foo')))
>>> old_tempdir = tempfile.gettempdir()
>>> tempdir = tempfile.tempdir = tempfile.mkdtemp(suffix='.buildout.build')
>>> dirs = glob.glob(os.path.join(tempdir, '*buildout-foo'))

>>> write('buildout.cfg',
... """
Expand All @@ -358,7 +358,7 @@ After a successful build, such temporary directories are removed.
... url = %sfoo.tgz
... """ % (distros_url,))

>>> print system("bin/buildout")
>>> print(system("bin/buildout"))
Installing foo.
foo: Downloading http://localhost:21445/foo.tgz
foo: Unpacking and configuring
Expand All @@ -369,6 +369,7 @@ After a successful build, such temporary directories are removed.
installing foo
<BLANKLINE>

>>> new_dirs = len(glob.glob(os.path.join(tempdir, '*buildout-foo')))
>>> dirs == new_dirs
>>> new_dirs = glob.glob(os.path.join(tempdir, '*buildout-foo'))
>>> len(dirs) == len(new_dirs) == 0
True
>>> tempfile.tempdir = old_tempdir

0 comments on commit 0db88c2

Please sign in to comment.