diff options
author | Alejandro Enedino Hernandez Samaniego <alejandro.enedino.hernandez-samaniego@xilinx.com> | 2018-09-04 23:45:43 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-09-06 10:36:31 +0100 |
commit | d3148222f06895be867dae8eb6ba33777f03a6a5 (patch) | |
tree | bbffe2307fba2cdf7a7af2b7bcf16fdd0cae54bb /meta/recipes-devtools | |
parent | e9b05a3feab9012ccd196fa00b73aa644fde7547 (diff) | |
download | poky-d3148222f06895be867dae8eb6ba33777f03a6a5.tar.gz |
python3: Modify create_manifest to make it versionless
This patch improves the create_manifest script by making it
use PYTHON_MAJMIN instead of hard coded paths containing the
version number when looking at the necessary modules for
every package, the script should now be independent of the
python(3) version on which were working
(From OE-Core rev: b94af33b5ffdd62617cf69fca4d99e927447740a)
Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r-- | meta/recipes-devtools/python/python3/create_manifest3.py | 10 | ||||
-rw-r--r-- | meta/recipes-devtools/python/python3_3.5.5.bb | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/meta/recipes-devtools/python/python3/create_manifest3.py b/meta/recipes-devtools/python/python3/create_manifest3.py index 2f944f9b13..41a6bb071a 100644 --- a/meta/recipes-devtools/python/python3/create_manifest3.py +++ b/meta/recipes-devtools/python/python3/create_manifest3.py | |||
@@ -44,6 +44,9 @@ import subprocess | |||
44 | import json | 44 | import json |
45 | import os | 45 | import os |
46 | 46 | ||
47 | # Get python version from ${PYTHON_MAJMIN} | ||
48 | pyversion = str(sys.argv[1]) | ||
49 | |||
47 | # Hack to get native python search path (for folders), not fond of it but it works for now | 50 | # Hack to get native python search path (for folders), not fond of it but it works for now |
48 | pivot='recipe-sysroot-native' | 51 | pivot='recipe-sysroot-native' |
49 | for p in sys.path: | 52 | for p in sys.path: |
@@ -62,6 +65,7 @@ hasfolders=[] | |||
62 | allfolders=[] | 65 | allfolders=[] |
63 | 66 | ||
64 | def isFolder(value): | 67 | def isFolder(value): |
68 | value = value.replace('${PYTHON_MAJMIN}',pyversion) | ||
65 | if os.path.isdir(value.replace('${libdir}',nativelibfolder+'/usr/lib')) or os.path.isdir(value.replace('${libdir}',nativelibfolder+'/usr/lib64')) or os.path.isdir(value.replace('${libdir}',nativelibfolder+'/usr/lib32')): | 69 | if os.path.isdir(value.replace('${libdir}',nativelibfolder+'/usr/lib')) or os.path.isdir(value.replace('${libdir}',nativelibfolder+'/usr/lib64')) or os.path.isdir(value.replace('${libdir}',nativelibfolder+'/usr/lib32')): |
66 | return True | 70 | return True |
67 | else: | 71 | else: |
@@ -85,6 +89,7 @@ print ('Getting dependencies for package: core') | |||
85 | # Special call to check for core package | 89 | # Special call to check for core package |
86 | output = subprocess.check_output([sys.executable, 'get_module_deps3.py', 'python-core-package']).decode('utf8') | 90 | output = subprocess.check_output([sys.executable, 'get_module_deps3.py', 'python-core-package']).decode('utf8') |
87 | for item in output.split(): | 91 | for item in output.split(): |
92 | item = item.replace(pyversion,'${PYTHON_MAJMIN}') | ||
88 | # We append it so it doesnt hurt what we currently have: | 93 | # We append it so it doesnt hurt what we currently have: |
89 | if isCached(item): | 94 | if isCached(item): |
90 | if item not in old_manifest['core']['cached']: | 95 | if item not in old_manifest['core']['cached']: |
@@ -98,6 +103,7 @@ for item in output.split(): | |||
98 | old_manifest['core']['files'].append(item) | 103 | old_manifest['core']['files'].append(item) |
99 | 104 | ||
100 | for value in old_manifest['core']['files']: | 105 | for value in old_manifest['core']['files']: |
106 | value = value.replace(pyversion,'${PYTHON_MAJMIN}') | ||
101 | # Ignore folders, since we don't import those, difficult to handle multilib | 107 | # Ignore folders, since we don't import those, difficult to handle multilib |
102 | if isFolder(value): | 108 | if isFolder(value): |
103 | # Pass it directly | 109 | # Pass it directly |
@@ -131,6 +137,8 @@ for value in old_manifest['core']['files']: | |||
131 | print ('The following dependencies were found for module %s:\n' % value) | 137 | print ('The following dependencies were found for module %s:\n' % value) |
132 | print (output) | 138 | print (output) |
133 | for item in output.split(): | 139 | for item in output.split(): |
140 | item = item.replace(pyversion,'${PYTHON_MAJMIN}') | ||
141 | |||
134 | # We append it so it doesnt hurt what we currently have: | 142 | # We append it so it doesnt hurt what we currently have: |
135 | if isCached(item): | 143 | if isCached(item): |
136 | if item not in old_manifest['core']['cached']: | 144 | if item not in old_manifest['core']['cached']: |
@@ -250,6 +258,7 @@ for key in old_manifest: | |||
250 | # is folder_string inside path/folder1/folder2/filename?, | 258 | # is folder_string inside path/folder1/folder2/filename?, |
251 | # Yes, it works, but we waste a couple of milliseconds. | 259 | # Yes, it works, but we waste a couple of milliseconds. |
252 | 260 | ||
261 | item = item.replace(pyversion,'${PYTHON_MAJMIN}') | ||
253 | inFolders=False | 262 | inFolders=False |
254 | for folder in allfolders: | 263 | for folder in allfolders: |
255 | if folder in item: | 264 | if folder in item: |
@@ -265,7 +274,6 @@ for key in old_manifest: | |||
265 | folderFound = True | 274 | folderFound = True |
266 | if keyfolder not in new_manifest[key]['rdepends'] and keyfolder != key: | 275 | if keyfolder not in new_manifest[key]['rdepends'] and keyfolder != key: |
267 | new_manifest[key]['rdepends'].append(keyfolder) | 276 | new_manifest[key]['rdepends'].append(keyfolder) |
268 | |||
269 | else: | 277 | else: |
270 | break | 278 | break |
271 | 279 | ||
diff --git a/meta/recipes-devtools/python/python3_3.5.5.bb b/meta/recipes-devtools/python/python3_3.5.5.bb index 8afe15eee6..9e31fa6f29 100644 --- a/meta/recipes-devtools/python/python3_3.5.5.bb +++ b/meta/recipes-devtools/python/python3_3.5.5.bb | |||
@@ -334,7 +334,7 @@ do_create_manifest() { | |||
334 | 334 | ||
335 | cd ${WORKDIR} | 335 | cd ${WORKDIR} |
336 | # This needs to be executed by python-native and NOT by HOST's python | 336 | # This needs to be executed by python-native and NOT by HOST's python |
337 | nativepython3 create_manifest3.py | 337 | nativepython3 create_manifest3.py ${PYTHON_MAJMIN} |
338 | cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json | 338 | cp python3-manifest.json.new ${THISDIR}/python3/python3-manifest.json |
339 | } | 339 | } |
340 | 340 | ||