new source packages on pythonhosted appear to change dashes in package
names to underscores in archive names and directories, for example:

python-license-expression ->
license-expression ->
https://files.pythonhosted.org/packages/source/l/license_expression/license_expression-30.3.1.tar.gz
-> license_expression-30.3.1/

although dashes in pythonhosted package directory names
still seem to work as an alternative:

https://files.pythonhosted.org/packages/source/l/license{-,_}expression/license_expression-30.3.1.tar.gz

but dashes work and underscores do not in older package version
archives, although underscores in pythonhosted package directory names
still seem to work as an alternative:

https://files.pythonhosted.org/packages/source/l/license{-,_}expression/license-expression-30.3.0.tar.gz

so keep pythonhosted package directory names verbatim and iterate setting
SRC_DIR to package name verbatim or underscored and test availability with:

    wget -q --spider ...
or
    curl --silent --fail -o /dev/null 2> /dev/null ...

Signed-off-by: Brian Inglis <brian.ing...@systematicsw.ab.ca>
---
 cygclass/python.org.cygclass | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cygclass/python.org.cygclass b/cygclass/python.org.cygclass
index 51434ba6c08f..a1b8fb89ec73 100644
--- a/cygclass/python.org.cygclass
+++ b/cygclass/python.org.cygclass
@@ -50,4 +50,8 @@ HOMEPAGE="https://pypi.org/project/${PYTHON_ORG_NAME}";
 #  DESCRIPTION
 #  Download location of the Python module on the Python Package Index.
 #****
-SRC_URI="https://files.pythonhosted.org/packages/source/${PYTHON_ORG_NAME:0:1}/${PYTHON_ORG_NAME}/${PYTHON_ORG_NAME}-${PV}.tar.gz";
+for SRC_DIR in ${PYTHON_ORG_NAME}-${PV} ${PYTHON_ORG_NAME//-/_}-${PV}
+do
+    
SRC_URI=https://files.pythonhosted.org/packages/source/${PYTHON_ORG_NAME:0:1}/${PYTHON_ORG_NAME}/${SRC_DIR}.tar.gz
+    wget --quiet --spider $SRC_URI && break
+done
-- 
2.45.1

Reply via email to