[meta-virtualization] [meta-cloud-services][fido-kilo][PATCH v2] Use a bbclass to remove argparse from requirements

Josep Puigdemont josep.puigdemont at enea.com
Wed Dec 9 04:40:19 PST 2015


argparse is required by some of the CLI applications of openstack. The
module is provided by python 2.7, however python-distribute (used in
fido), is not able to find it:

Python 2.7.9 (default, Oct 27 2015, 18:12:55)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pkg_resources
>>> pkg_resources.get_distribution('argparse')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File
"/usr/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py",
line 338, in get_distribution
    if isinstance(dist,Requirement): dist = get_provider(dist)
  File
"/usr/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py",
line 217, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File
"/usr/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py",
line 698, in require
    needed = self.resolve(parse_requirements(requirements))
  File
"/usr/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py",
line 596, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: argparse
>>> import argparse
>>>

This patch adds a class that when inherited will remove argparse from
requirements.txt. Also with this patch, those python modules used by
openstackclient inherit the class.

Signed-off-by: Josep Puigdemont <josep.puigdemont at enea.com>
---
 meta-openstack/classes/rmargparse.bbclass                           | 3 +++
 meta-openstack/recipes-devtools/python/python-cinderclient_git.bb   | 2 +-
 meta-openstack/recipes-devtools/python/python-cliff_1.10.0.bb       | 2 +-
 meta-openstack/recipes-devtools/python/python-glanceclient_git.bb   | 2 +-
 meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb | 2 +-
 meta-openstack/recipes-devtools/python/python-neutronclient_git.bb  | 2 +-
 meta-openstack/recipes-devtools/python/python-novaclient_git.bb     | 2 +-
 meta-openstack/recipes-devtools/python/python-oslo.config_1.9.3.bb  | 2 +-
 meta-openstack/recipes-devtools/python/python-stevedore_1.3.0.bb    | 2 +-
 9 files changed, 11 insertions(+), 8 deletions(-)
 create mode 100644 meta-openstack/classes/rmargparse.bbclass

diff --git a/meta-openstack/classes/rmargparse.bbclass b/meta-openstack/classes/rmargparse.bbclass
new file mode 100644
index 0000000..65d8459
--- /dev/null
+++ b/meta-openstack/classes/rmargparse.bbclass
@@ -0,0 +1,3 @@
+do_install_append() {
+    sed -i '/argparse/d' ${D}${libdir}/python2.7/site-packages/*/requires.txt
+}
diff --git a/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb b/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb
index 951198d..1590ed4 100644
--- a/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-cinderclient_git.bb
@@ -17,7 +17,7 @@ PV="1.1.2+git${SRCPV}"
 SRCREV="b44d32d02b014748044b5b18d27a9d1f8312145c"
 S = "${WORKDIR}/git"
 
-inherit setuptools monitor
+inherit setuptools monitor rmargparse
 
 DEPENDS += " \
         python-pip \
diff --git a/meta-openstack/recipes-devtools/python/python-cliff_1.10.0.bb b/meta-openstack/recipes-devtools/python/python-cliff_1.10.0.bb
index e7e1f7e..4a9dc9f 100644
--- a/meta-openstack/recipes-devtools/python/python-cliff_1.10.0.bb
+++ b/meta-openstack/recipes-devtools/python/python-cliff_1.10.0.bb
@@ -15,7 +15,7 @@ SRC_URI[sha256sum] = "209882e199fdf98aeed0db44b922aa688e5a66d81c45148a5743804f9a
 
 S = "${WORKDIR}/${SRCNAME}-${PV}"
 
-inherit setuptools
+inherit setuptools rmargparse
 
 DEPENDS += " \
 	python-pbr \
diff --git a/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb b/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb
index 430e32d..2ced1e9 100644
--- a/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-glanceclient_git.bb
@@ -15,7 +15,7 @@ SRC_URI = "\
 
 S = "${WORKDIR}/git"
 
-inherit setuptools monitor
+inherit setuptools monitor rmargparse
 
 FILES_${PN} += "${datadir}/${SRCNAME}"
 
diff --git a/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb b/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb
index 5c5d98c..b538cbf 100644
--- a/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-keystoneclient_git.bb
@@ -16,7 +16,7 @@ PV = "1.3.3+git${SRCPV}"
 SRCREV = "ec70eb02f8a5889828cde786694283240f64c5c4"
 S = "${WORKDIR}/git"
 
-inherit setuptools monitor
+inherit setuptools monitor rmargparse
 
 FILES_${PN}-doc += "${datadir}/keystoneclient" 
 
diff --git a/meta-openstack/recipes-devtools/python/python-neutronclient_git.bb b/meta-openstack/recipes-devtools/python/python-neutronclient_git.bb
index e35be5d..16a2e92 100644
--- a/meta-openstack/recipes-devtools/python/python-neutronclient_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-neutronclient_git.bb
@@ -29,7 +29,7 @@ PV = "2.4.0+git${SRCPV}"
 SRCREV = "aa1215a5ad063b299d32ef319eb63d5210249a9b"
 S = "${WORKDIR}/git"
 
-inherit setuptools monitor
+inherit setuptools monitor rmargparse
 
 PACKAGECONFIG ?= "bash-completion"
 PACKAGECONFIG[bash-completion] = ",,bash-completion,bash-completion ${BPN}-bash-completion"
diff --git a/meta-openstack/recipes-devtools/python/python-novaclient_git.bb b/meta-openstack/recipes-devtools/python/python-novaclient_git.bb
index 1e60fb4..dd0151a 100644
--- a/meta-openstack/recipes-devtools/python/python-novaclient_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-novaclient_git.bb
@@ -13,7 +13,7 @@ PV = "2.23.2+git${SRCPV}"
 SRCREV = "4ab9db648653f7ea6b9f8b1c78bff672b20b913f"
 S = "${WORKDIR}/git"
 
-inherit setuptools monitor
+inherit setuptools monitor rmargparse
 
 DEPENDS = "python-setuptools-git"
 DEPENDS += " \
diff --git a/meta-openstack/recipes-devtools/python/python-oslo.config_1.9.3.bb b/meta-openstack/recipes-devtools/python/python-oslo.config_1.9.3.bb
index 3094b1e..ec1340d 100644
--- a/meta-openstack/recipes-devtools/python/python-oslo.config_1.9.3.bb
+++ b/meta-openstack/recipes-devtools/python/python-oslo.config_1.9.3.bb
@@ -14,7 +14,7 @@ SRC_URI[sha256sum] = "ab54e67776d9bbee86ba8cce9393ba3186e6e63de926e9797598dc35fe
 
 S = "${WORKDIR}/${SRCNAME}-${PV}"
 
-inherit setuptools
+inherit setuptools rmargparse
 
 DEPENDS += " \
         python-pbr \
diff --git a/meta-openstack/recipes-devtools/python/python-stevedore_1.3.0.bb b/meta-openstack/recipes-devtools/python/python-stevedore_1.3.0.bb
index 6100f68..73b054a 100644
--- a/meta-openstack/recipes-devtools/python/python-stevedore_1.3.0.bb
+++ b/meta-openstack/recipes-devtools/python/python-stevedore_1.3.0.bb
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
 SRC_URI[md5sum] = "e9ed2a1cf91ee76fd9045f902fa58089"
 SRC_URI[sha256sum] = "beab2b7f91966d259796392c39ed6f260b32851861561dd9f3b9be2fd0c426a5"
 
-inherit pypi
+inherit pypi rmargparse
 
 DEPENDS += " \
         python-pip \
-- 
2.5.0



More information about the meta-virtualization mailing list