Fix buildout.

This commit is contained in:
Timo Stollenwerk 2015-01-29 19:32:43 +01:00
parent 785bc7b890
commit 07076e157b
2 changed files with 62 additions and 44 deletions

View File

@ -56,6 +56,11 @@ parser.add_option("-c", "--config-file",
"file to be used.")) "file to be used."))
parser.add_option("-f", "--find-links", parser.add_option("-f", "--find-links",
help=("Specify a URL to search for buildout releases")) help=("Specify a URL to search for buildout releases"))
parser.add_option("--allow-site-packages",
action="store_true", default=False,
help=("Let bootstrap.py use existing site packages"))
parser.add_option("--setuptools-version",
help="use a specific setuptools version")
options, args = parser.parse_args() options, args = parser.parse_args()
@ -63,30 +68,40 @@ options, args = parser.parse_args()
###################################################################### ######################################################################
# load/install setuptools # load/install setuptools
to_reload = False
try: try:
import pkg_resources if options.allow_site_packages:
import setuptools import setuptools
except ImportError: import pkg_resources
ez = {}
try:
from urllib.request import urlopen from urllib.request import urlopen
except ImportError: except ImportError:
from urllib2 import urlopen from urllib2 import urlopen
# XXX use a more permanent ez_setup.py URL when available. ez = {}
exec(urlopen('https://bitbucket.org/pypa/setuptools/raw/0.7.2/ez_setup.py' exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
).read(), ez)
setup_args = dict(to_dir=tmpeggs, download_delay=0)
ez['use_setuptools'](**setup_args)
if to_reload: if not options.allow_site_packages:
reload(pkg_resources) # ez_setup imports site, which adds site packages
import pkg_resources # this will remove them from the path to ensure that incompatible versions
# This does not (always?) update the default working set. We will # of setuptools are not in the path
# do it. import site
for path in sys.path: # inside a virtualenv, there is no 'getsitepackages'.
# We can't remove these reliably
if hasattr(site, 'getsitepackages'):
for sitepackage_path in site.getsitepackages():
sys.path[:] = [x for x in sys.path if sitepackage_path not in x]
setup_args = dict(to_dir=tmpeggs, download_delay=0)
if options.setuptools_version is not None:
setup_args['version'] = options.setuptools_version
ez['use_setuptools'](**setup_args)
import setuptools
import pkg_resources
# This does not (always?) update the default working set. We will
# do it.
for path in sys.path:
if path not in pkg_resources.working_set.entries: if path not in pkg_resources.working_set.entries:
pkg_resources.working_set.add_entry(path) pkg_resources.working_set.add_entry(path)
@ -119,10 +134,15 @@ if version is None and not options.accept_buildout_test_releases:
_final_parts = '*final-', '*final' _final_parts = '*final-', '*final'
def _final_version(parsed_version): def _final_version(parsed_version):
try:
return not parsed_version.is_prerelease
except AttributeError:
# Older setuptools
for part in parsed_version: for part in parsed_version:
if (part[:1] == '*') and (part not in _final_parts): if (part[:1] == '*') and (part not in _final_parts):
return False return False
return True return True
index = setuptools.package_index.PackageIndex( index = setuptools.package_index.PackageIndex(
search_path=[setuptools_path]) search_path=[setuptools_path])
if find_links: if find_links:
@ -149,8 +169,7 @@ cmd.append(requirement)
import subprocess import subprocess
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0: if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
raise Exception( raise Exception(
"Failed to execute command:\n%s", "Failed to execute command:\n%s" % repr(cmd)[1:-1])
repr(cmd)[1:-1])
###################################################################### ######################################################################
# Import and run buildout # Import and run buildout

View File

@ -1,14 +1,19 @@
[buildout] [buildout]
extends = https://raw.github.com/collective/buildout.plonetest/master/test-4.3.x.cfg extends = http://dist.plone.org/release/4.3.4/versions.cfg
package-name = plone.app.discussion parts =
package-extras = [test] instance
parts +=
mkrelease mkrelease
pocompile pocompile
code-analysis code-analysis
i18ndude i18ndude
update_translations update_translations
[instance]
recipe = plone.recipe.zope2instance
http-address = 8080
user = admin:admin
eggs = Plone
[mkrelease] [mkrelease]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = jarn.mkrelease eggs = jarn.mkrelease
@ -22,17 +27,6 @@ recipe = plone.recipe.codeanalysis
directory = ${buildout:directory}/plone/app/discussion directory = ${buildout:directory}/plone/app/discussion
flake8-max-complexity = 50 flake8-max-complexity = 50
[versions]
plone.app.discussion =
zope.interface = 4.0.5
plone.app.portlets = 2.5a1
plone.dexterity = 2.2.1
plone.app.querystring = 1.1.0
plone.app.jquery = 1.8.3
plone.app.testing = 4.2.4
plone.app.vocabularies = 2.1.14
[i18ndude] [i18ndude]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = eggs =
@ -60,3 +54,8 @@ input = inline:
msgfmt --no-hash -o $BASE_PATH/i18n/plone-$LANG.mo $BASE_PATH/i18n/plone-$LANG.po msgfmt --no-hash -o $BASE_PATH/i18n/plone-$LANG.mo $BASE_PATH/i18n/plone-$LANG.po
done done
mode = 755 mode = 755
[versions]
zope.interface = 4.0.5
zc.buildout = 2.3.1
setuptools = 8.0.4