-
-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added build system to project root #372
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
language: python | ||
sudo: false | ||
cache: | ||
pip: true | ||
directories: | ||
- $TRAVIS_BUILD_DIR/buildout-cache | ||
python: | ||
- 2.7 | ||
addons: | ||
apt: | ||
packages: | ||
- libpcre3 | ||
- libpcre3-dev | ||
- libssl-dev | ||
- libexpat1-dev | ||
- gnuplot | ||
- libgdk-pixbuf2.0-0 | ||
# needed libs for chromedriver | ||
# - libnss3-dev | ||
# - libgconf-2-4 | ||
before_script: | ||
### Install the latest chromedriver manually from https://sites.google.com/a/chromium.org/chromedriver/downloads | ||
# NB: must be setuid root to move this executable | ||
# => commented out, since the chrome browser exits unexpeted and the robot tests are not passing anyhow | ||
# - wget http://chromedriver.storage.googleapis.com/2.26/chromedriver_linux64.zip | ||
# - unzip chromedriver_linux64.zip | ||
# - sudo mv chromedriver /usr/bin/ | ||
### | ||
- export DISPLAY=99.0 | ||
- sh -e /etc/init.d/xvfb start | ||
before_install: | ||
- mkdir -p $TRAVIS_BUILD_DIR/buildout-cache/{eggs,downloads} | ||
- echo "[buildout]" > $TRAVIS_BUILD_DIR/default.cfg | ||
- echo "download-cache = $TRAVIS_BUILD_DIR/buildout-cache/downloads" >> $TRAVIS_BUILD_DIR/default.cfg | ||
- echo "eggs-directory = $TRAVIS_BUILD_DIR/buildout-cache/eggs" >> $TRAVIS_BUILD_DIR/default.cfg | ||
- virtualenv . | ||
- bin/pip install --upgrade pip setuptools zc.buildout | ||
install: | ||
- bin/buildout -n -t 3 -c travis.cfg | ||
script: | ||
- bin/test -m bika.lims --layer=bika.lims.testing.BikaTestingLayer:Functional | ||
- bin/test test_textual_doctests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,210 @@ | ||
############################################################################## | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also it seems bootstrap.py is not required when installing zc.buildout into virtualenv? maybe we could remove it. If anyone needs to do it this way, bootstrap.py is easy to get. |
||
# | ||
# Copyright (c) 2006 Zope Foundation and Contributors. | ||
# All Rights Reserved. | ||
# | ||
# This software is subject to the provisions of the Zope Public License, | ||
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. | ||
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED | ||
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS | ||
# FOR A PARTICULAR PURPOSE. | ||
# | ||
############################################################################## | ||
"""Bootstrap a buildout-based project | ||
|
||
Simply run this script in a directory containing a buildout.cfg. | ||
The script accepts buildout command-line options, so you can | ||
use the -c option to specify an alternate configuration file. | ||
""" | ||
|
||
import os | ||
import shutil | ||
import sys | ||
import tempfile | ||
|
||
from optparse import OptionParser | ||
|
||
__version__ = '2015-07-01' | ||
# See zc.buildout's changelog if this version is up to date. | ||
|
||
tmpeggs = tempfile.mkdtemp(prefix='bootstrap-') | ||
|
||
usage = '''\ | ||
[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] | ||
|
||
Bootstraps a buildout-based project. | ||
|
||
Simply run this script in a directory containing a buildout.cfg, using the | ||
Python that you want bin/buildout to use. | ||
|
||
Note that by using --find-links to point to local resources, you can keep | ||
this script from going over the network. | ||
''' | ||
|
||
parser = OptionParser(usage=usage) | ||
parser.add_option("--version", | ||
action="store_true", default=False, | ||
help=("Return bootstrap.py version.")) | ||
parser.add_option("-t", "--accept-buildout-test-releases", | ||
dest='accept_buildout_test_releases', | ||
action="store_true", default=False, | ||
help=("Normally, if you do not specify a --version, the " | ||
"bootstrap script and buildout gets the newest " | ||
"*final* versions of zc.buildout and its recipes and " | ||
"extensions for you. If you use this flag, " | ||
"bootstrap and buildout will get the newest releases " | ||
"even if they are alphas or betas.")) | ||
parser.add_option("-c", "--config-file", | ||
help=("Specify the path to the buildout configuration " | ||
"file to be used.")) | ||
parser.add_option("-f", "--find-links", | ||
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("--buildout-version", | ||
help="Use a specific zc.buildout version") | ||
parser.add_option("--setuptools-version", | ||
help="Use a specific setuptools version") | ||
parser.add_option("--setuptools-to-dir", | ||
help=("Allow for re-use of existing directory of " | ||
"setuptools versions")) | ||
|
||
options, args = parser.parse_args() | ||
if options.version: | ||
print("bootstrap.py version %s" % __version__) | ||
sys.exit(0) | ||
|
||
|
||
###################################################################### | ||
# load/install setuptools | ||
|
||
try: | ||
from urllib.request import urlopen | ||
except ImportError: | ||
from urllib2 import urlopen | ||
|
||
ez = {} | ||
if os.path.exists('ez_setup.py'): | ||
exec(open('ez_setup.py').read(), ez) | ||
else: | ||
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez) | ||
|
||
if not options.allow_site_packages: | ||
# ez_setup imports site, which adds site packages | ||
# this will remove them from the path to ensure that incompatible versions | ||
# of setuptools are not in the path | ||
import site | ||
# inside a virtualenv, there is no 'getsitepackages'. | ||
# We can't remove these reliably | ||
if hasattr(site, 'getsitepackages'): | ||
for sitepackage_path in site.getsitepackages(): | ||
# Strip all site-packages directories from sys.path that | ||
# are not sys.prefix; this is because on Windows | ||
# sys.prefix is a site-package directory. | ||
if sitepackage_path != sys.prefix: | ||
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 | ||
if options.setuptools_to_dir is not None: | ||
setup_args['to_dir'] = options.setuptools_to_dir | ||
|
||
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: | ||
pkg_resources.working_set.add_entry(path) | ||
|
||
###################################################################### | ||
# Install buildout | ||
|
||
ws = pkg_resources.working_set | ||
|
||
setuptools_path = ws.find( | ||
pkg_resources.Requirement.parse('setuptools')).location | ||
|
||
# Fix sys.path here as easy_install.pth added before PYTHONPATH | ||
cmd = [sys.executable, '-c', | ||
'import sys; sys.path[0:0] = [%r]; ' % setuptools_path + | ||
'from setuptools.command.easy_install import main; main()', | ||
'-mZqNxd', tmpeggs] | ||
|
||
find_links = os.environ.get( | ||
'bootstrap-testing-find-links', | ||
options.find_links or | ||
('http://downloads.buildout.org/' | ||
if options.accept_buildout_test_releases else None) | ||
) | ||
if find_links: | ||
cmd.extend(['-f', find_links]) | ||
|
||
requirement = 'zc.buildout' | ||
version = options.buildout_version | ||
if version is None and not options.accept_buildout_test_releases: | ||
# Figure out the most recent final version of zc.buildout. | ||
import setuptools.package_index | ||
_final_parts = '*final-', '*final' | ||
|
||
def _final_version(parsed_version): | ||
try: | ||
return not parsed_version.is_prerelease | ||
except AttributeError: | ||
# Older setuptools | ||
for part in parsed_version: | ||
if (part[:1] == '*') and (part not in _final_parts): | ||
return False | ||
return True | ||
|
||
index = setuptools.package_index.PackageIndex( | ||
search_path=[setuptools_path]) | ||
if find_links: | ||
index.add_find_links((find_links,)) | ||
req = pkg_resources.Requirement.parse(requirement) | ||
if index.obtain(req) is not None: | ||
best = [] | ||
bestv = None | ||
for dist in index[req.project_name]: | ||
distv = dist.parsed_version | ||
if _final_version(distv): | ||
if bestv is None or distv > bestv: | ||
best = [dist] | ||
bestv = distv | ||
elif distv == bestv: | ||
best.append(dist) | ||
if best: | ||
best.sort() | ||
version = best[-1].version | ||
if version: | ||
requirement = '=='.join((requirement, version)) | ||
cmd.append(requirement) | ||
|
||
import subprocess | ||
if subprocess.call(cmd) != 0: | ||
raise Exception( | ||
"Failed to execute command:\n%s" % repr(cmd)[1:-1]) | ||
|
||
###################################################################### | ||
# Import and run buildout | ||
|
||
ws.add_entry(tmpeggs) | ||
ws.require(requirement) | ||
import zc.buildout.buildout | ||
|
||
if not [a for a in args if '=' not in a]: | ||
args.append('bootstrap') | ||
|
||
# if -c was provided, we push it back into args for buildout' main function | ||
if options.config_file is not None: | ||
args[0:0] = ['-c', options.config_file] | ||
|
||
zc.buildout.buildout.main(args) | ||
shutil.rmtree(tmpeggs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
# This buildout can be used to obtain a complete test system from scratch: | ||
# | ||
# virtualevnv --no-site-packages . | ||
# source bin/activate | ||
# python bootstrap.py | ||
# bin/buildout | ||
# bin/instance start | ||
# | ||
|
||
[buildout] | ||
extends = http://dist.plone.org/release/4.3.15/versions.cfg | ||
versions = versions | ||
develop = . | ||
|
||
find-links = | ||
http://dist.plone.org/release/4.3.15 | ||
http://dist.plone.org/thirdparty | ||
|
||
parts = | ||
instance | ||
i18ndude | ||
update_translations | ||
write_code_headers | ||
code-analysis | ||
lxml | ||
test | ||
robot | ||
omelette | ||
|
||
eggs = | ||
bika.lims | ||
plone.reload | ||
i18ndude | ||
lxml | ||
zcml = | ||
|
||
[instance] | ||
recipe = plone.recipe.zope2instance | ||
user = admin:adminsecret | ||
eggs = | ||
${buildout:eggs} | ||
zcml = | ||
${buildout:zcml} | ||
environment-vars = | ||
zope_i18n_compile_mo_files true | ||
|
||
[i18ndude] | ||
unzip = true | ||
recipe = zc.recipe.egg | ||
eggs = i18ndude | ||
|
||
[update_translations] | ||
recipe = collective.recipe.template | ||
output = ${buildout:directory}/bin/update_translations | ||
input = ${buildout:directory}/templates/update_translations.in | ||
mode = 755 | ||
|
||
[write_code_headers] | ||
recipe = collective.recipe.template | ||
output = ${buildout:directory}/bin/write_code_headers | ||
input = ${buildout:directory}/templates/write_code_headers.py.in | ||
mode = 755 | ||
|
||
# https://github.com/plone/plone.recipe.codeanalysis | ||
[code-analysis] | ||
recipe = plone.recipe.codeanalysis | ||
directory = ${buildout:directory}/bika/lims | ||
pre-commit-hook = False | ||
clean-lines = True | ||
clean-lines-exclude = | ||
**/node_modules/* | ||
find-untranslated = False | ||
i18ndude-bin = ${buildout:bin-directory}/i18ndude | ||
utf8-header = True | ||
deprecated-aliases = True | ||
flake8-extensions = | ||
flake8-blind-except | ||
flake8-coding | ||
flake8-debugger | ||
# http://pep8.readthedocs.io/en/latest/intro.html#error-codes | ||
# E241: multiple spaces after ‘,’ | ||
# E301: expected 1 blank line, found 0 (e.g. the class security pattern "security.declare...") | ||
# E501: line too long (82 > 79 characters) | ||
flake8-ignore = E241,E301,E501 | ||
multiprocessing = True | ||
return-status-codes = False | ||
|
||
[lxml] | ||
recipe = z3c.recipe.staticlxml | ||
egg = lxml==2.3.6 | ||
force = false | ||
static-build = true | ||
|
||
[test] | ||
recipe = zc.recipe.testrunner | ||
defaults = ['--auto-color', '--auto-progress'] | ||
eggs = | ||
bika.lims [test] | ||
|
||
[robot] | ||
recipe = zc.recipe.egg | ||
eggs = | ||
${buildout:eggs} | ||
plone.app.robotframework | ||
|
||
[omelette] | ||
recipe = collective.recipe.omelette | ||
eggs = ${buildout:eggs} | ||
|
||
# Please download ipy_profile_zope to ~/.ipython/profile_zope/startup/ipy_profile_zope.py | ||
# https://raw.githubusercontent.com/collective/dotipython/master/ipy_profile_zope.py | ||
# cd ~/.ipython/profile_zope/startup/ && wget https://raw.githubusercontent.com/collective/dotipython/master/ipy_profile_zope.py | ||
# Run ./bin/ipzope | ||
[ipzope] | ||
recipe = zc.recipe.egg | ||
eggs = | ||
ipython | ||
${instance:eggs} | ||
initialization = | ||
import sys, os | ||
os.environ["SOFTWARE_HOME"] = "${instance:location}" | ||
os.environ["INSTANCE_HOME"] = "${instance:location}" | ||
sys.argv[1:1] = "--profile zope".split() | ||
extra-paths = | ||
${instance:location}/lib/python | ||
scripts = ipython=ipzope | ||
|
||
[versions] | ||
setuptools = | ||
zc.buildout = | ||
CairoSVG = 1.0.20 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramonski I'm pretty sure we don't xvfb anymore, it was used for running firefox for robot-framework tests. I don't think we need robot-framework right now.