10 Commits

Author SHA1 Message Date
James E. Blair
9d2d2455a8 Add final newline check for requirements
Ensure that every line has a newline; particularly the last one.

Change-Id: I8cfa194461946fb78dc9ea0aa51cf6158d5bb81c
2013-08-16 13:43:59 -07:00
James E. Blair
9f06bccfb8 Fix line parsing in requirements check
The requirements check script would strip one character from the end
of every line without a #, which was a problem if the last line
of the file had neither a # or a newline.

Change-Id: I89f1114695adc4de6ef95a96cffcf919c88a2ac8
2013-08-16 13:42:12 -07:00
Sean Dague
d1564bffb9 support global-requirements.txt
We are changing the upstream requirements.txt and
test-requirements.txt to a combinded global-requirements.txt.
Changes the checking script to support this as a possible file as
well. This should be a seemless backwards compatible change.

While modifying this file, also fix the flake8 style issues.

Change-Id: I95ccd6f721a2c7f4e873d1de171d569bae0631e8
2013-08-01 22:35:37 -04:00
Mark McLoughlin
71726d834a Only skip openstack tarballs in requirements check
We really only want to allow openstack tarball requirements to be added
without checking, not just any tarball.

Change-Id: I0ce458c95dc2fba07100b921d094ff174ed7da57
Reviewed-on: https://review.openstack.org/36070
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Khai Do <zaro0508@gmail.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
2013-07-12 23:08:59 +00:00
Mark McLoughlin
3d6e24418a Use dev-requirements.txt in openstack/requirements
We wish to be able to use pre-release versions of some libraries during
the development cycle. The principle is that we don't want to expose
users of the stable release of those libraries to the churn that happens
during a development cycle. More background on this is described here:

  https://wiki.openstack.org/wiki/Oslo

The requirements.txt files in this repository are used for two purposes.
Firstly to describe what libraries projects are allowed to use and,
secondly, what libraries to populate our PyPI mirror with.

In the case of these development versions of libraries, they aren't
released to PyPI so we don't want them to be appear in our PyPI mirror.
So, we need to add a file which is only used for the first purpose and
ignored by the mirror-building job.

We allow dev-requirements.txt to list newer versions of libraries which
are already listed in requirements.txt so that we still get the stable
version in our mirror.

Change-Id: I176d40404adac6f7dcb2a255b9c42eb3d2c9321e
Reviewed-on: https://review.openstack.org/36128
Reviewed-by: Doug Hellmann <doug.hellmann@dreamhost.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Reviewed-by: Julien Danjou <julien@danjou.info>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
2013-07-10 19:09:57 +00:00
Mark McLoughlin
e13eab706a Ignore --find-links lines in requirement checks
Fixes bug #1194807

In quantum, we currently have a URL based requirement:

  http://.../oslo.config-1.2.0a2.tar.gz#egg=oslo.config-1.2.0a2

The requirements check currently ignores this.

It turns out that pip has a bug which doesn't where you can end up with
the oslo.config 1.1.1 code installed. This is because oslo.config>=1.1.0
gets pulled in as a transitive dep and pip gets confused. You can
reproduce with e.g.

  $> pip install \
       http://.../oslo.config-1.2.0a3.tar.gz#egg=oslo.config-1.2.0a3 \
       python-keystoneclient
  $> pip freeze | grep oslo.config
  oslo.config-1.2.0a3
  $> python -c 'from oslo.config.cfg import DeprecatedOpt'
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
  ImportError: cannot import name DeprecatedOpt

This is because of a bug with pip where it sees oslo.config-1.2.0a3 and
oslo.config as two unrelated things. It should strip the version part of
the egg= fragment before using it as a package name, but it doesn't.

However, we can simply use the -f/--find-links pip option in our
requirements.txt to add the tarball URL to the list of URLs considered
and also add the oslo.config>=1.2.0a3 dependency:

  $> pip install \
       -f http://.../oslo.config-1.2.0a3.tar.gz#egg=oslo.config-1.2.0a3 \
       'oslo.config>=1.2.0a3' \
       python-keystoneclient
  $> pip freeze | grep oslo.config
  oslo.config-1.2.0a3
  $> python -c 'from oslo.config.cfg import DeprecatedOpt'

This is actually exactly the semantics we want and we go to great
lengths in pbr to get these semantics while using a single tarball URL.
The only downside to this --find-links strategy is that we gain an extra
line in our requirements.txt ... but it does work around the pip bug.

I think it makes sense for the requirements check to just ignore
--find-links lines for now like it does for URLs and -editable lines.
Using this method means we actually do require new versions of libraries
consumed this way to be approved into openstack/requirements first since
we have an explicit 'oslo.config>=1.2.0a3' listed rather than that being
derived from a URL.

It may make sense in future to have automation around checking which
find-links URLs are allowed ... but the same can be true for normal
dependency URLs. This change allows us to move forward and use latest
oslo.config in Nova, Neutron, etc. without falling foul of the pip bug.

Change-Id: I6f3eb5fd2c75615d9a1cae172aed859b36b27d4c
Reviewed-on: https://review.openstack.org/35296
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Monty Taylor <mordred@inaugust.com>
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Tested-by: Jenkins
2013-07-02 23:14:03 +00:00
James E. Blair
05cd301f8b Clone requirements into a tempdir.
Git doesn't remove git repos with git clean, so the workspace
checkout of the requirements repo was stale.  Clone into a
tempdir instead.

Also, fix a traceback in the case that a new requirement is added.
The loop wasn't short-circuiting as it should in that case.

Print the git sha from the requirements repo to aid in debugging.

Reorder imports.

Change-Id: Id5a8e748a1fb353f2628a9c9fa291d6825d1046d
Reviewed-on: https://review.openstack.org/26791
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Approved: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
2013-04-11 21:16:28 +00:00
Clark Boylan
ac538fdb38 Fix comparison between Python Requirement objects.
pkg_resources.Requirement implements __eq__() but not __ne__(). There is
no implied relationship between __eq__() and __ne__() so we must negate
the result of == instead of using !=.

Change-Id: Ie83f87687f5666e6511265f2b9acdd42f38f1dd2
Reviewed-on: https://review.openstack.org/25974
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Approved: James E. Blair <corvus@inaugust.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Tested-by: Jenkins
2013-04-03 16:55:53 +00:00
Clark Boylan
742e9cb9cc Compare requirements case insensitively.
Pip treats package names as case insensitive which has resulted in
different cases being used in the various project requirements files.
Use a case insensitive comparison when comparing a project against
openstack/requirements to avoid invalid comparison failures.

Change-Id: I59b3362ffb68d1c4662ac5d94919de47f0506218
Reviewed-on: https://review.openstack.org/25639
Reviewed-by: Khai Do <zaro0508@gmail.com>
Reviewed-by: James E. Blair <corvus@inaugust.com>
Approved: Jeremy Stanley <fungi@yuggoth.org>
Reviewed-by: Jeremy Stanley <fungi@yuggoth.org>
Tested-by: Jenkins
2013-03-28 18:27:43 +00:00
James E. Blair
f8cd914eb8 Add a requirements testing script.
Can be used to verify that updated requirements match those
specified in openstack/requirements.

Change-Id: Ieec680f0373786b75eaf947af15c60a78c763180
Reviewed-on: https://review.openstack.org/23843
Reviewed-by: Monty Taylor <mordred@inaugust.com>
Approved: Clark Boylan <clark.boylan@gmail.com>
Reviewed-by: Clark Boylan <clark.boylan@gmail.com>
Tested-by: Jenkins
2013-03-07 22:29:46 +00:00