python: fix pip translator

This commit is contained in:
DavHau 2022-03-14 10:14:23 +07:00
parent 753452e0fb
commit cd223d4669
2 changed files with 8 additions and 5 deletions

View File

@ -40,10 +40,9 @@ in {
jsonInput=$1
# read the json input
outputFile=$(${jq}/bin/jq '.outputFile' -c -r $jsonInput)
source=$(${jq}/bin/jq '.source' -c -r $jsonInput)
pythonAttr=$(${jq}/bin/jq '.pythonAttr' -c -r $jsonInput)
application=$(${jq}/bin/jq '.application' -c -r $jsonInput)
outputFile=$WORKDIR/$(${jq}/bin/jq '.outputFile' -c -r $jsonInput)
source="$(${jq}/bin/jq '.source' -c -r $jsonInput)/$(${jq}/bin/jq '.project.relPath' -c -r $jsonInput)"
pythonAttr=$(${jq}/bin/jq '.project.subsystemInfo.pythonAttr' -c -r $jsonInput)
# build python and pip executables
tmpBuild=$(mktemp -d)
@ -89,6 +88,7 @@ in {
-r $tmpBuild/computed_requirements
# -r ''${inputFiles/$'\n'/$' -r '}
cd $WORKDIR
# generate the dream lock from the downloaded list of files
NAME=$(${jq}/bin/jq '.name' -c -r $tmpBuild/python.json) \
VERSION=$(${jq}/bin/jq '.version' -c -r $tmpBuild/python.json) \

View File

@ -3,6 +3,7 @@ import base64
import hashlib
import json
import os
import pathlib
import sys
import urllib.request
@ -66,7 +67,7 @@ def main():
"sourcesAggregatedHash": None,
},
_subsystem={
"application": jsonInput['application'],
"application": jsonInput.get('application', False),
"pythonAttr": f"python{sys.version_info.major}{sys.version_info.minor}",
"sourceFormats":
{pname: data['format'] for pname, data in packages.items()}
@ -85,6 +86,8 @@ def main():
# dump dream lock to $ouputFile
print(jsonInput['outputFile'])
dirPath = pathlib.Path(os.path.dirname(jsonInput['outputFile']))
dirPath.mkdir(parents=True, exist_ok=True)
with open(jsonInput['outputFile'], 'w') as lock:
json.dump(dream_lock, lock, indent=2)