Skip to content

Commit

Permalink
Merge c0505ee into c912bfe
Browse files Browse the repository at this point in the history
  • Loading branch information
hvelarde committed Jun 28, 2016
2 parents c912bfe + c0505ee commit b68afda
Show file tree
Hide file tree
Showing 8 changed files with 146 additions and 88 deletions.
14 changes: 5 additions & 9 deletions .coveragerc
@@ -1,11 +1,7 @@
[run]
include = src/collective/syndication/*

[report]
omit =
/home/*/.buildout/eggs/*
/usr/*
bin/test
buildout-cache/eggs/*
eggs/*
parts/*
*/bin/test
*/eggs/*
*/lib/python*
*/parts/*
*/usr/*
38 changes: 25 additions & 13 deletions .travis.yml
@@ -1,20 +1,32 @@
language: python
python: 2.7
env: PLONE_VERSION=4.2 QA=true
sudo: false
cache:
directories:
- eggs
env:
matrix:
- PLONE_VERSION=4.2
matrix:
include:
- python: 2.6
env: PLONE_VERSION=4.1
- python: 2.6
env: PLONE_VERSION=4.1
fast_finish: true
install:
- cp travis-$PLONE_VERSION.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.2#test-$PLONE_VERSION#" buildout.cfg
- sed -ie "s#versions-4.2#versions-$PLONE_VERSION#" buildout.cfg
- python bootstrap.py
- bin/buildout annotate
- bin/buildout
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script: bin/test
after_success: test $QA && bin/coverage.sh && pip install -q coveralls && coveralls || true
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
script:
- bin/code-analysis
- bin/test
after_success:
- bin/createcoverage
- pip install coveralls
- coveralls
notifications:
irc: irc.freenode.org#simplesconsultoria
irc: irc.freenode.org#plone-testing
65 changes: 37 additions & 28 deletions README.rst
Expand Up @@ -7,29 +7,42 @@ collective.syndication
Life, the Universe, and Everything
----------------------------------

``collective.syndication`` improves standard syndication on Plone sites by
providing 5 feed types: `Atom`_, iTunes, `NewsML 1`_, `RSS 1.0`_ and `RSS
2.0`_.
``collective.syndication`` improves standard syndication on Plone sites by providing 5 feed types:
`Atom <https://www.ietf.org/rfc/rfc4287.txt>`_, iTunes, `NewsML 1 <https://www.iptc.org/site/News_Exchange_Formats/NewsML_1/>`_, `RSS 1.0 <http://web.resource.org/rss/1.0/spec>`_ and `RSS 2.0 <https://cyber.law.harvard.edu/rss/rss.html>`_.

This package is a backport for Plone 4.1 and 4.2 of `Nathan Van Gheem`_'s
`Improved Syndication`_ PLIP implementation made for Plone 4.3.
This package is a backport for Plone 4.1 and 4.2 of Nathan Van Gheem's `Improved Syndication <https://dev.plone.org/ticket/12908>`_ PLIP implementation made for Plone 4.3.

Mostly Harmless
---------------

.. image:: https://secure.travis-ci.org/collective/collective.syndication.png?branch=master
:alt: Travis CI badge
.. image:: http://img.shields.io/pypi/v/collective.syndication.svg
:target: https://pypi.python.org/pypi/collective.syndication

.. image:: https://img.shields.io/travis/collective/collective.syndication/master.svg
:target: http://travis-ci.org/collective/collective.syndication

.. image:: https://coveralls.io/repos/collective/collective.syndication/badge.png?branch=master
:alt: Coveralls badge
.. image:: https://img.shields.io/coveralls/collective/collective.syndication/master.svg
:target: https://coveralls.io/r/collective/collective.syndication

.. image:: https://pypip.in/d/collective.syndication/badge.png
:alt: Downloads
:target: https://pypi.python.org/pypi/collective.syndication
Got an idea? Found a bug? Let us know by `opening a support ticket <https://github.com/collective/collective.syndication/issues>`_.

Known Issues
^^^^^^^^^^^^

If you migrated your site from Plone 4.2 to Plone 4.3, odds are you are facing the following error:

.. code-block:: python
Got an idea? Found a bug? Let us know by `opening a support ticket`_.
PicklingError: Can't pickle <class 'collective.syndication.interfaces.ISyndicatable'>: import of module collective.syndication.interfaces failed
To fix this, you should add the following code to your policy package:

.. code-block:: python
# BBB: avoid PicklingError in Plone 4.3
import sys
from Products.CMFPlone.interfaces import syndication
sys.modules['collective.syndication.interfaces'] = sys.modules[syndication.__name__]
Don't Panic
-----------
Expand All @@ -39,21 +52,21 @@ Installation

To enable this product in a buildout-based installation:

1. Edit your buildout.cfg and add ``collective.syndication`` to the list
of eggs to install::
1. Edit your buildout.cfg and add ``collective.syndication`` to the list of eggs to install:

.. code-block:: ini
[buildout]
...
eggs =
collective.syndication
After updating the configuration you need to run ''bin/buildout'', which will
take care of updating your system.
After updating the configuration you need to run ''bin/buildout'',
which will take care of updating your system.

Go to the 'Site Setup' page in a Plone site and click on the 'Add-ons' link.

Check the box next to ``collective.syndication`` and click the 'Activate'
button.
Check the box next to ``collective.syndication`` and click the 'Activate' button.

Feeds
^^^^^
Expand All @@ -70,7 +83,7 @@ The primary use case that Atom addresses is the syndication of Web content
such as weblogs and news headlines to Web sites as well as directly to user
agents.

Atom feeds have multiple `advantages`_ over RSS feeds.
Atom feeds have multiple `advantages <http://www.intertwingly.net/wiki/pie/Rss20AndAtom10Compared>`_ over RSS feeds.

iTunes
++++++
Expand Down Expand Up @@ -100,11 +113,7 @@ RSS 2.0

TBD.

.. _`advantages`: http://www.intertwingly.net/wiki/pie/Rss20AndAtom10Compared
.. _`Atom`: https://www.ietf.org/rfc/rfc4287.txt
.. _`Improved Syndication`: https://dev.plone.org/ticket/12908
.. _`Nathan Van Gheem`: https://github.com/vangheem
.. _`NewsML 1`: https://www.iptc.org/site/News_Exchange_Formats/NewsML_1/
.. _`opening a support ticket`: https://github.com/collective/collective.syndication/issues
.. _`RSS 1.0`: http://web.resource.org/rss/1.0/spec
.. _`RSS 2.0`: https://cyber.law.harvard.edu/rss/rss.html
Migrating to Plone 4.3
^^^^^^^^^^^^^^^^^^^^^^

Before migrating a site to Plone 4.3 you should uninstall and remove this package from your buildout configuration.
74 changes: 53 additions & 21 deletions bootstrap.py
Expand Up @@ -25,7 +25,10 @@

from optparse import OptionParser

tmpeggs = tempfile.mkdtemp()
__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]
Expand All @@ -35,13 +38,14 @@
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.
'''

parser = OptionParser(usage=usage)
parser.add_option("-v", "--version", help="use a specific zc.buildout version")

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,
Expand All @@ -59,36 +63,57 @@
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:
if options.allow_site_packages:
import setuptools
import pkg_resources
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen

ez = {}
exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), 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
# 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]
# 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
Expand All @@ -104,7 +129,12 @@

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]

Expand All @@ -117,21 +147,23 @@
if find_links:
cmd.extend(['-f', find_links])

setuptools_path = ws.find(
pkg_resources.Requirement.parse('setuptools')).location

requirement = 'zc.buildout'
version = options.version
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):
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:
Expand All @@ -156,7 +188,7 @@ def _final_version(parsed_version):
cmd.append(requirement)

import subprocess
if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
if subprocess.call(cmd) != 0:
raise Exception(
"Failed to execute command:\n%s" % repr(cmd)[1:-1])

Expand Down
29 changes: 18 additions & 11 deletions buildout.cfg
Expand Up @@ -2,32 +2,39 @@
extends =
https://raw.github.com/collective/buildout.plonetest/master/test-4.2.x.cfg
https://raw.github.com/collective/buildout.plonetest/master/qa.cfg
versions-4.2.cfg

package-name = collective.syndication
package-extras = [test]
eggs = Pillow
test-eggs = ${:eggs}
test-eggs = Pillow

parts +=
code-analysis
createcoverage
i18ndude
omelette
rebuild_i18n-sh

[code-analysis]
recipe = plone.recipe.codeanalysis[recommended]
directory = ${buildout:directory}/src/collective/syndication
pre-commit-hook = True
flake8-ignore = E501
flake8-ignore = C101,D001,E501,I001,P001,P002,Q000,S001,T000
flake8-max-complexity = 11
pre-commit-hook = True

[instance]
eggs += iw.debug
zcml += iw.debug
[i18ndude]
recipe = zc.recipe.egg
eggs = i18ndude

[omelette]
recipe = collective.recipe.omelette
eggs = ${instance:eggs}

[i18ndude]
unzip = true
recipe = zc.recipe.egg
eggs = i18ndude
[versions]
# use latest version of coverage and setuptools
coverage =
setuptools =
# avoid flake8: error: no such option: --max-complexity
flake8 = 2.6.2
# avoid ValueError: too many values to unpack under Plone 4.1
zc.buildout = 1.7.1
11 changes: 8 additions & 3 deletions setup.cfg
@@ -1,4 +1,9 @@
[distutils]
index-servers =
pypi
ploneorg
index-servers = pypi

[isort]
force_alphabetical_sort = True
force_single_line = True
line_length = 200
lines_after_imports = 2
not_skip = __init__.py
File renamed without changes.
3 changes: 0 additions & 3 deletions travis-4.2.cfg → versions-4.2.cfg
Expand Up @@ -11,6 +11,3 @@ test-eggs = Pillow
parts +=
createcoverage
coverage-sh

[versions]
setuptools =

0 comments on commit b68afda

Please sign in to comment.