21 Commits

Author SHA1 Message Date
Tony Breeds
4bb92e041c Integrate normalize as part of the requirements tools
Rather than have this as an external tool that open codes some of the logic
we have in the existing codebase we should integrate it.

Change-Id: I979dcefeec4ae28705088d4fac1e41b4d33e40e0
2016-06-23 10:16:23 +02:00
Davanum Srinivas
9e0ff3a550 Check conflicts script
Use pkg_resources.require to report conflicts to ensure
co-installability.

Co-Authored-By: Igor Yozhikov <iyozhikov@mirantis.com>
Change-Id: I7443496b6a06d02bb9cc9457b729dea71451f44a
2016-06-02 16:24:00 -04:00
Tony Breeds
2ee3cbb721 Check that the argument is in fact a directory
If you mistakenly pass a path that isn't a directory, or doens't exist,
you get a traceback that ends with:
 ---
  File "/Users/tony8129/projects/openstack/openstack/requirements/openstack_requirements/cmds/update.py", line 229, in _copy_requires
    dest_path, project.merge_setup_cfg(proj['setup.cfg'], output_extras)))
KeyError: 'setup.cfg'
ERROR: InvocationError: '.../openstack/requirements/.tox/update/bin/update-requirements -H -s ./nova'
---

This is a little confusing.  This patch checks that the arg is a
directory so a more explicit error can be generated.

Change-Id: I9f3f43d5c9b90746bbf2d651ee4cb37afade1528
2016-05-23 14:09:52 +10:00
Jenkins
2e7df9c0ac Merge "add a validation command to ensure projects use check-requirements" 2016-05-17 10:24:01 +00:00
Jenkins
af1eccf965 Merge "Fix use of a renamed itertools function in python3" 2016-05-16 20:58:20 +00:00
Doug Hellmann
bcc1779def add a validation command to ensure projects use check-requirements
Add a command and tox environment to let us define a job to ensure that
all repos in projects.txt have the check-requirements job defined. Two
projects are missing the job now, so this patch depends on the patch to
add those jobs.

Change-Id: I61658a7265a77e72401978dda558f41b28a81d92
Depends-On: I81e1c70257e28583e776171580d75341e620bf8d
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2016-05-12 16:15:46 -04:00
Jamie Lennox
5033a0f716 Allow maintaining extras from project
A project needs to be able to specify that it depends on a project
including extras for that project and still have it's version maintained
by global-requirements.

Currently if the requirements are seen to mismatch then the string from
global requirements is dropped in place of the project string, but this
drops any extras specified by project.

In the case that extras are different and the version needs updating add
a new combined requirement to the project with the original extras and
the new version.

Closes-Bug: #1567809
Change-Id: Ife48b7963a5e6706289f1b9a47cb95fae7f0bc22
2016-04-14 15:01:13 +10:00
Stéphane Albert
62818c3069 Fix use of a renamed itertools function in python3
In python3 izip functions got renamed to zip in itertools module.
This was breaking support for python3.

Change-Id: I6fda87b78e40be134d7c94698cca5d85a51eb989
2016-03-30 11:40:14 +02:00
Costin Galan
7bca319451 Add Windows as supported operating system
This change is necessary in order to use the project's
update-requirements.py script when preparing the environment on the
Hyper-V compute nodes used in the Hyper-V CI. Using the mentioned script
will set the latest requirements in nova, neutron, manila, etc.,
reducing the CI's amount of failures caused by outdated requirements.

Including Microsoft Windows as a supported operating system on this
project. Also, we update the edit-constraints.py and project.py
files to support os.rename() of Windows.

On Windows, os.rename() will create a file with the source
name, without deleting the initial file first.

Example of a traceback:

 Traceback (most recent call last):
   File "C:\Python27\Scripts\edit-constraints-script.py", line 9, in
 <module>
     load_entry_point('openstack.requirements==0.0.1.dev2497',
 'console_scripts', 'edit-constraints')()
   File
 "C:\Python27\lib\site-packages\openstack_requirements\cmds\edit_constraint.py",
 line 74, in main
     os.rename(args[0] + '.tmp', args[0])
 WindowsError: [Error 183] Cannot create a file when that file already exists

This could be easily solved by removing the file before the rename.

Proposed fix:
Add before "os.rename(args[0] + '.tmp', args[0])" the line "os.remove(args[0])"
in edit_constraint.py
Add before "os.rename(tmpname, fullname)" the line "os.remove(fullname)"
in project.py
Add "Operating System :: Microsoft :: Windows" in setup.cfg

DocImpact: Added Windows as a supported OS in setup.cfg
Change-Id: If123a65fd8d49d5c67a1db16827a9617ce520dba
Signed-off-by: Costin Galan <cgalan@cloudbasesolutions.com>
2016-02-26 14:25:50 +02:00
Davanum Srinivas
47fdbc1391 Deal with underscores in blacklist during generate-constraints
In change id  I60adf0dca4aa32f4ef6bca61250b375c8a3703c6, we added
flake8_docstrings to the black list. However as seen in
I8bfff1b2e65541959e7f2ae0fa6ca6c17889eb54, the generate-constraints
job ends up proposing adding "flake8-docstrings===0.2.1.post1" to
the upper-constraints.txt. This is because of the '-' vs '_'
difference. So just like in Ibaa22657a2cf2c0ad96dbd0b9bc43cdafe6a1d56,
we need to convert the items in black list to the correct safe name
before trying to check if the item is in the black list.

Change-Id: Ieb1cd44e908b80d58a20bf0d0e1e6b10f17ae95e
2015-11-07 23:00:12 -05:00
Jenkins
ef82c13bf7 Merge "Deal with underscores in names in edit-constraints" 2015-09-17 16:09:16 +00:00
Robert Collins
b95d747cfa Update our handling of pbr.
*) We're removing our upper caps - they are just time bombs. Make pbr
   be consistent here too.

*) pbr 1.8 handles comments in marker lines properly. We don't need to
   update the run-time minimum, but we do need a build-time minimum of
   1.8 to ensure OpenStack packages can build properly.

Change-Id: I9fe0c62e774c00c2e521e1e69c5f2f5d87865ec1
2015-09-17 10:20:17 +12:00
Davanum Srinivas
3ebedf84f0 Deal with underscores in names in edit-constraints
Problem showed up with django_openstack_auth job that installs from
source. The change to devstack to verify LIBS_FROM_GIT kicked in
(Iffef2007f99a0e932b68c4c897ebbfb748cac2b4) and starting failing the
job. The problem was that the edit_constraint was not fixing the
django-openstack-auth line in upperconstraints.txt as the setup.cfg
had name = django_openstack_auth. Note that when things finally get
installed setup_tools' safe_name kicks in to standardize names and for
example glance_store will show up as glance-store in pip freeze. So we
should be able to treat this situation better and allow constraints to
have the safe names (using dashes).

Co-Authored-By: Robert Collins <rbtcollins@hp.com>
Change-Id: Ibaa22657a2cf2c0ad96dbd0b9bc43cdafe6a1d56
2015-09-17 10:12:11 +12:00
Doug Hellmann
2dbf39295c Move data validation out of the unit tests and strengthen
Having the data validation happening inside the unit tests makes
understanding requirement update failures confusing because the output
is hard to read and does not explain what the error actually is. Move
the checks to their own command and set up a tox env to run it. A
separate patch in project-config will add a new job for the repository.

Address the dedent comment from
https://review.openstack.org/#/c/204181/3/openstack_requirements/tests/test_requirement.py,cm

Add a test to ensure that all items in global-requirements.txt are also
listed in either upper-constraints.txt or blacklist.txt. Ignore a few
items that we don't know how to constrain yet.

Add a test to ensure that items in blacklist.txt are not in
upper-constraints.txt.

Change-Id: Icb717b0f36afb6ea29f50bc6935917dddf47fd4c
2015-08-03 20:45:37 +00:00
Jenkins
8ddf1fcffd Merge "Place an accurate lower bound on pbr" 2015-07-15 00:08:33 +00:00
Robert Collins
0937f0d3a2 Place an accurate lower bound on pbr
Without this version, markers will fail to install in a growing number
of projects.

Change global-requirements to prevent
pip -r requirements.txt; pip install .
failing with an already installed and too old for setup_requires pbr.

Change update.py to signal to setuptools the minimum version required,
giving clearer error messages in the case of downgrades during
devstack.

Change-Id: I074274b470a7a4f2c95211677b135038ab2c942c
2015-07-12 09:54:33 +12:00
Russell Bryant
931defba21 Stop adding extra newline after unparseable lines.
I have a project that includes a requirement line this:

    -e git://git.openstack.org/openstack/neutron.git#egg=neutron

Every time update.py runs against the file, it adds an extra newline
after this.  For example, if I run update.py a few times, I'll have a
few new lines in the file.  This patch prevents the extra newlines
from getting added.

Change-Id: I92d02a45c437025b16df067d7b58a3727d42c0e0
Signed-off-by: Russell Bryant <rbryant@redhat.com>
2015-07-08 10:37:02 -04:00
Robert Collins
63e5747001 Fix editing constraints files with urls in them.
constraints files, unlike global_requirements, need to be able to
contain urls (specifically file:/// paths) so that we can constrain
libraries to be run from their git trees, rather than having them flap
all over the place as different servers specify different bounds. The
first edit-constraints implementation failed to parse such lines,
throwing errors instead.

This patch makes the support for urls optional, preventing changing
the semantics of requirements update.py logic.

Change-Id: I33bd2d9dff9cb7dc1a50177db7286b7317966784
Depends-On: I0f07858e96ea3baf46f8a453e253b9ed29c7f7e2
2015-07-04 09:54:39 +12:00
Robert Collins
b838ab1e43 Add location to requirement.Requirement
This will provide space to store the result of parsing requirements
like -e file:///opt/stack/new/oslo.THING, which we need to do for
edit-constraint to work in devstack when more than one library is
being installed from git. This is a separate patch to make reviewing
the actual new functionality easier - it is entirely mechanical,
adding the field and dealing with test fallout.

Change-Id: Ied4e92717b0dab871dac42ae639d1f2a6c236414
2015-07-03 12:23:09 +12:00
Robert Collins
893490c958 Add edit-constraints command.
This allows shell editing of a constraints file, which we need to do
in devstack when installing a constrained library from git.

Change-Id: Ibdbfc786b5d2f56d2e41d329c8766bef7b2e6854
2015-06-29 15:44:17 +12:00
Robert Collins
3aa37f7ea4 Move commands into cmds subdir.
This is a useful hint to readers about whether a module is library or UI.

Change-Id: I177449fc6820e82fed938f2c216b6b9f9192957f
2015-06-29 15:27:25 +12:00