mirror of
https://git.yoctoproject.org/poky
synced 2026-05-06 04:39:01 +00:00
python3: fix indentation on create_manifest3
(From OE-Core rev: 76b4596c3782590bd27a7d46c2b64393c3a83944) Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
a8a984dde7
commit
c05304f1ea
@@ -50,8 +50,8 @@ pyversion = str(sys.argv[1])
|
|||||||
# Hack to get native python search path (for folders), not fond of it but it works for now
|
# Hack to get native python search path (for folders), not fond of it but it works for now
|
||||||
pivot = 'recipe-sysroot-native'
|
pivot = 'recipe-sysroot-native'
|
||||||
for p in sys.path:
|
for p in sys.path:
|
||||||
if pivot in p:
|
if pivot in p:
|
||||||
nativelibfolder = p[:p.find(pivot)+len(pivot)]
|
nativelibfolder = p[:p.find(pivot)+len(pivot)]
|
||||||
|
|
||||||
# Empty dict to hold the whole manifest
|
# Empty dict to hold the whole manifest
|
||||||
new_manifest = {}
|
new_manifest = {}
|
||||||
@@ -65,21 +65,21 @@ hasfolders = []
|
|||||||
allfolders = []
|
allfolders = []
|
||||||
|
|
||||||
def isFolder(value):
|
def isFolder(value):
|
||||||
value = value.replace('${PYTHON_MAJMIN}',pyversion)
|
value = value.replace('${PYTHON_MAJMIN}',pyversion)
|
||||||
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')):
|
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')):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def isCached(item):
|
def isCached(item):
|
||||||
if '__pycache__' in item:
|
if '__pycache__' in item:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Read existing JSON manifest
|
# Read existing JSON manifest
|
||||||
with open('python3-manifest.json') as manifest:
|
with open('python3-manifest.json') as manifest:
|
||||||
old_manifest = json.load(manifest)
|
old_manifest = json.load(manifest)
|
||||||
|
|
||||||
#
|
#
|
||||||
# First pass to get core-package functionality, because we base everything on the fact that core is actually working
|
# First pass to get core-package functionality, because we base everything on the fact that core is actually working
|
||||||
@@ -114,50 +114,50 @@ for coredep in output.split():
|
|||||||
# pass them to the manifest directly.
|
# pass them to the manifest directly.
|
||||||
|
|
||||||
for filedep in old_manifest['core']['files']:
|
for filedep in old_manifest['core']['files']:
|
||||||
if isFolder(filedep):
|
if isFolder(filedep):
|
||||||
if isCached(filedep):
|
if isCached(filedep):
|
||||||
if filedep not in old_manifest['core']['cached']:
|
if filedep not in old_manifest['core']['cached']:
|
||||||
old_manifest['core']['cached'].append(filedep)
|
old_manifest['core']['cached'].append(filedep)
|
||||||
else:
|
else:
|
||||||
|
if filedep not in old_manifest['core']['files']:
|
||||||
|
old_manifest['core']['files'].append(filedep)
|
||||||
|
continue
|
||||||
|
if '${bindir}' in filedep:
|
||||||
if filedep not in old_manifest['core']['files']:
|
if filedep not in old_manifest['core']['files']:
|
||||||
old_manifest['core']['files'].append(filedep)
|
old_manifest['core']['files'].append(filedep)
|
||||||
continue
|
continue
|
||||||
if '${bindir}' in filedep:
|
if filedep == '':
|
||||||
if filedep not in old_manifest['core']['files']:
|
continue
|
||||||
old_manifest['core']['files'].append(filedep)
|
if '${includedir}' in filedep:
|
||||||
continue
|
if filedep not in old_manifest['core']['files']:
|
||||||
if filedep == '':
|
old_manifest['core']['files'].append(filedep)
|
||||||
continue
|
continue
|
||||||
if '${includedir}' in filedep:
|
|
||||||
if filedep not in old_manifest['core']['files']:
|
|
||||||
old_manifest['core']['files'].append(filedep)
|
|
||||||
continue
|
|
||||||
|
|
||||||
# Get actual module name , shouldnt be affected by libdir/bindir, etc.
|
# Get actual module name , shouldnt be affected by libdir/bindir, etc.
|
||||||
pymodule = os.path.splitext(os.path.basename(os.path.normpath(filedep)))[0]
|
pymodule = os.path.splitext(os.path.basename(os.path.normpath(filedep)))[0]
|
||||||
|
|
||||||
|
|
||||||
# We now know that were dealing with a python module, so we can import it
|
# We now know that were dealing with a python module, so we can import it
|
||||||
# and check what its dependencies are.
|
# and check what its dependencies are.
|
||||||
# We launch a separate task for each module for deterministic behavior.
|
# We launch a separate task for each module for deterministic behavior.
|
||||||
# Each module will only import what is necessary for it to work in specific.
|
# Each module will only import what is necessary for it to work in specific.
|
||||||
# The output of each task will contain each module's dependencies
|
# The output of each task will contain each module's dependencies
|
||||||
|
|
||||||
print ('Getting dependencies for module: %s' % pymodule)
|
print ('Getting dependencies for module: %s' % pymodule)
|
||||||
output = subprocess.check_output([sys.executable, 'get_module_deps3.py', '%s' % pymodule]).decode('utf8')
|
output = subprocess.check_output([sys.executable, 'get_module_deps3.py', '%s' % pymodule]).decode('utf8')
|
||||||
print ('The following dependencies were found for module %s:\n' % pymodule)
|
print ('The following dependencies were found for module %s:\n' % pymodule)
|
||||||
print (output)
|
print (output)
|
||||||
|
|
||||||
|
|
||||||
for pymodule_dep in output.split():
|
for pymodule_dep in output.split():
|
||||||
pymodule_dep = pymodule_dep.replace(pyversion,'${PYTHON_MAJMIN}')
|
pymodule_dep = pymodule_dep.replace(pyversion,'${PYTHON_MAJMIN}')
|
||||||
|
|
||||||
if isCached(pymodule_dep):
|
if isCached(pymodule_dep):
|
||||||
if pymodule_dep not in old_manifest['core']['cached']:
|
if pymodule_dep not in old_manifest['core']['cached']:
|
||||||
old_manifest['core']['cached'].append(pymodule_dep)
|
old_manifest['core']['cached'].append(pymodule_dep)
|
||||||
else:
|
else:
|
||||||
if pymodule_dep not in old_manifest['core']['files']:
|
if pymodule_dep not in old_manifest['core']['files']:
|
||||||
old_manifest['core']['files'].append(pymodule_dep)
|
old_manifest['core']['files'].append(pymodule_dep)
|
||||||
|
|
||||||
|
|
||||||
# At this point we are done with the core package.
|
# At this point we are done with the core package.
|
||||||
|
|||||||
Reference in New Issue
Block a user