summaryrefslogtreecommitdiff
path: root/auto
diff options
context:
space:
mode:
authordavidovski <david@davidovski.xyz>2022-03-06 00:20:49 +0000
committerdavidovski <david@davidovski.xyz>2022-03-06 00:20:49 +0000
commitad95cf3c8430f90225b628e072c35717ce86945c (patch)
treea58f33d4d534e7d5544e7249a52a0003386fe380 /auto
parent80220d777d783fc0b11c491f0c93eb712d38e427 (diff)
added pypi python modules
Diffstat (limited to 'auto')
-rwxr-xr-xauto/pypi.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/auto/pypi.sh b/auto/pypi.sh
new file mode 100755
index 0000000..05656f7
--- /dev/null
+++ b/auto/pypi.sh
@@ -0,0 +1,37 @@
+if [ $# = 0 ]; then
+ printf "Name of package: python-"
+ read name
+else
+ name=$1
+fi
+
+if ! pip show $name > /dev/null; then
+ echo "Failed to find $name"
+ exit 1
+fi
+
+json=$(curl -SsL https://pypi.org/pypi/$name/json)
+version=$(echo $json | jq -r '.info.version')
+desc=$(echo $json | jq -r '.info.summary')
+url=$(echo $json | jq -r '.urls[] | select((.version="1.0.3")) | .url' | grep -v "whl" | sed "s/$version/\$PKG_VER/g")
+deps=$(echo $json | jq -r '.info.requires_dist | .[]' | cut -d' ' -f1 | tr '\n' ' ')
+if [ ${#deps} != 0 ]; then
+ package_deps=$(echo $deps | sed 's/\(\w*\)/python-\1/g')
+ echo $package_deps
+fi
+
+file=repo/python/python-$name.xibuild
+
+cat templates/pypi.xibuild |
+ sed "s@^SOURCE=.*@SOURCE=$url@g" |
+ sed "s/^PKG_VER=.*/PKG_VER=$version/g" |
+ sed "s/^DESC=.*/DESC=\"$desc\"/g" |
+ sed "s/^DEPS=.*/DEPS=\"$package_deps\"/g" > $file
+echo written to $file
+
+if [ ${#deps} != 0 ]; then
+ for p in $deps; do
+ $0 $p
+ done
+fi
+