diff --git a/.coveragerc b/.coveragerc index 3abdedb..f5fdb21 100644 --- a/.coveragerc +++ b/.coveragerc @@ -7,4 +7,3 @@ omit = eggs/* parts/* src/collective/civicrm/pythoncivicrm.py - src/collective/civicrm/timer.py diff --git a/.travis.yml b/.travis.yml index e29a6f5..1f0181b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,33 @@ language: python python: 2.7 +sudo: false +cache: + directories: + - eggs env: - - PLONE_VERSION=4.2 - - PLONE_VERSION=4.3 QA=true - - PLONE_VERSION=5.0 +- PLONE_VERSION=4.2 +- PLONE_VERSION=4.3 +- PLONE_VERSION=5.0 matrix: allow_failures: - - env: PLONE_VERSION=5.0 + - env: PLONE_VERSION=4.2 + - env: PLONE_VERSION=5.0 fast_finish: true install: - - sed -ie "s#travis-4.x.cfg#travis-$PLONE_VERSION.x.cfg#" travis.cfg - - mkdir -p buildout-cache/downloads - - python bootstrap.py -c travis.cfg - - bin/buildout -c travis.cfg annotate - - bin/buildout -c travis.cfg -N -q +- sed -ie "s#test-4.3#test-$PLONE_VERSION#" buildout.cfg +- python bootstrap.py +- bin/buildout annotate +- bin/buildout -Nq before_script: - - export DISPLAY=:99.0 - - sh -e /etc/init.d/xvfb start -script: bin/code-analysis && bin/test -after_success: test $QA && bin/coverage.sh && pip install -q coveralls && coveralls || true -after_failure: firefox -v +- export DISPLAY=:99.0 +- sh -e /etc/init.d/xvfb start +- firefox -v +script: +- bin/code-analysis +- bin/test +after_success: +- bin/createcoverage +- pip install -q coveralls +- coveralls notifications: irc: irc.freenode.org#plone-testing diff --git a/bootstrap.py b/bootstrap.py index ed57894..a629566 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -35,7 +35,7 @@ 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 +Note that by using --find-links to point to local resources, you can keep this script from going over the network. ''' @@ -59,6 +59,8 @@ 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() @@ -79,16 +81,20 @@ 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 + # 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'. + # 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 @@ -128,10 +134,15 @@ _final_parts = '*final-', '*final' def _final_version(parsed_version): - for part in parsed_version: - if (part[:1] == '*') and (part not in _final_parts): - return False - return True + 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: diff --git a/buildout.cfg b/buildout.cfg index 1f77c22..46b2b7c 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -2,27 +2,32 @@ extends = https://raw.github.com/collective/buildout.plonetest/master/test-4.3.x.cfg https://raw.github.com/collective/buildout.plonetest/master/qa.cfg + https://raw.github.com/plone/plone.app.robotframework/master/versions.cfg package-name = collective.civicrm package-extras = [test] parts += code-analysis + createcoverage i18ndude omelette [code-analysis] +recipe = plone.recipe.codeanalysis directory = ${buildout:directory}/src/collective/civicrm -pre-commit-hook = True +clean-lines = True +deprecated-aliases = True flake8-exclude = pythoncivicrm.py +flake8-extensions = + flake8-blind-except + flake8-coding + flake8-debugger + flake8-quotes flake8-ignore = E501 flake8-max-complexity = 18 -clean-lines = True -deprecated-aliases = True -imports = False -prefer-single-quotes = False +multiprocessing = True return-status-codes = True -utf8-header = False [i18ndude] recipe = zc.recipe.egg @@ -31,3 +36,8 @@ eggs = i18ndude [omelette] recipe = collective.recipe.omelette eggs = ${test:eggs} + +[versions] +plone.recipe.codeanalysis = 2.0b1 +# use latest version of setuptools +setuptools = diff --git a/src/collective/civicrm/tests/__init__.py b/src/collective/civicrm/tests/__init__.py index e69de29..40a96af 100644 --- a/src/collective/civicrm/tests/__init__.py +++ b/src/collective/civicrm/tests/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/src/collective/civicrm/upgrades/__init__.py b/src/collective/civicrm/upgrades/__init__.py index e69de29..40a96af 100644 --- a/src/collective/civicrm/upgrades/__init__.py +++ b/src/collective/civicrm/upgrades/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/src/collective/civicrm/upgrades/v1010/__init__.py b/src/collective/civicrm/upgrades/v1010/__init__.py index e69de29..40a96af 100644 --- a/src/collective/civicrm/upgrades/v1010/__init__.py +++ b/src/collective/civicrm/upgrades/v1010/__init__.py @@ -0,0 +1 @@ +# -*- coding: utf-8 -*- diff --git a/travis.cfg b/travis.cfg deleted file mode 100644 index 4c746c8..0000000 --- a/travis.cfg +++ /dev/null @@ -1,30 +0,0 @@ -[buildout] -extends = - https://raw.github.com/collective/buildout.plonetest/master/travis-4.3.x.cfg - https://raw.github.com/collective/buildout.plonetest/master/qa.cfg - -package-name = collective.civicrm -package-extras = [test] -package-min-coverage = 90 - -parts += - coverage-sh - createcoverage - -[code-analysis] -directory = ${buildout:directory}/src/collective/civicrm -pre-commit-hook = False -flake8-exclude = pythoncivicrm.py -flake8-ignore = E501 -flake8-max-complexity = 18 -clean-lines = True -deprecated-aliases = True -imports = False -prefer-single-quotes = False -return-status-codes = True -utf8-header = False - -[versions] -pep8 = 1.5.7 -# use latest version of setuptools -setuptools =