[PATCH] cygport cygclass/python.org.cygclass pythonhosted archives may require underscores not dashes
Brian Inglis
Brian.Inglis@SystematicSw.ab.ca
Mon Jul 7 08:48:20 GMT 2025
On 2025-07-06 12:16, Jon Turney wrote:
> On 28/06/2025 19:04, Brian Inglis via Cygwin-apps wrote:
> [...]
>> https://cygwin.com/cgit/cygwin-packages/python-license-expression/tree/
>> python-license-expression.cygport
>
> (As an aside, I trimmed six other URLs here. For me, this just makes your email
> more effort to read. If we're talking about the contortions in your current
> cygport, that's all I need to be looking at...)
>
>> PH_URI=https://files.pythonhosted.org/packages
>> V_URI=bb/79/efb4637d56dcd265cb9329ab502be0e01f4daed80caffdc5065b4b7956df
>> SHA_URI=sha256=49f439fea91c4d1a642f9f2902b58db1d42396c5e331045f41ce50df9b40b1f2
>> SRC_DIR=${BASE//-/_}-$VERSION
>> SRC_URI=$PH_URI/$V_URI/$SRC_DIR.tar.gz # #$SHA_URI
>
> So, fortunately, this doesn't appear to be necessary. Reading the documentation
> on pypi.org leads me to [1].
>
> [1] https://docs.pypi.org/api/#predictable-urls
>
> e.g.
>
>> $ curl -I https://files.pythonhosted.org/packages/source/l/license_expression/
>> license_expression-30.4.3.tar.gz
>> HTTP/2 302
>> content-type: application/octet-stream
>> location: https://files.pythonhosted.org/packages/bb/79/
>> efb4637d56dcd265cb9329ab502be0e01f4daed80caffdc5065b4b7956df/
>> license_expression-30.4.3.tar.gz
>> [...]
>
> (Doubly fortunate, I came across this *before* wasting my time writing something
> to access their API to map a (project, version) to a URL in order to fetch the
> source distribution, which seems crazy to me)
> > Could someone who develops in python please have a look and suggest what
>> we should do about improving how the packaging scripts operate, to be able to
>> support python standard package downloads, installs, and testing, without
>> these complaints and failures?
>
> I am by no means a python expert. But I've made a change in cygport 0.37.1 to
> use the predicable URL format they specify.
>
> This seems to work, so you should be able to remove the contortions above from
> your cygport and let the python.org cygclass set the SRC_URI once more.
>
> Please let me know if there are any problems.
>
>>> On 2024-11-06 10:14, Brian Inglis via Cygwin-apps wrote:
> [...]
>>>> "It should be noted that legacy URLs are no longer supported and may stop
>>>> working at an arbitrary time."
>
> I think "legacy" in this context means "URLs based on non-PEP 625-normalized
> project names"?
Thanks Jon, get works fine now, tested with cygport 0.37.1 on py-lic-expr
deprecated and unreleased 30.4.2, but prep SRC_DIR needs to match the
distribution file name:
$ cygport --debug python-license-expression.cygport get prep
...
>>> Unpacking source license_expression-30.4.2.tar.gz
+ defined unpack_out
+ (( 1 != 1 ))
+ '[' -n '' ']'
+ return 1
+ tar xf /var/cache/cygport/upstream/license_expression-30.4.2.tar.gz
+ '[' '!' -d
/usr/src/python-license-expression/python-license-expression-30.4.2-1.noarch/origsrc/license-expression-30.4.2
']'
+ error 'SRC_DIR is not correctly defined'
+ case $? in
+ local errorcode=1
+ echo -e '\e[1;31m*** ERROR:\e[0;0m SRC_DIR is not correctly defined'
*** ERROR: SRC_DIR is not correctly defined
+ exit 1
$ ls -Gg python-license-expression-30.4.2-1.noarch/origsrc/
total 8
drwxr-xr-x 1 0 Jun 24 13:59 license_expression-30.4.2
The original PEPs have now been deprecated and the content moved into the main
PyPA specs which refer to normalization of binary and source distribution and
file names, following the binary distribution file name rules s/[-._]/_/g etc.
to remove any excess hyphens or dots from source and binary distribution and
file names, including distribution archive directory and metadata names which
must match, but not PyPI package or project names which remain unnormalized.
https://packaging.python.org/en/latest/specifications/source-distribution-format/
--
Take care. Thanks, Brian Inglis Calgary, Alberta, Canada
La perfection est atteinte Perfection is achieved
non pas lorsqu'il n'y a plus rien à ajouter not when there is no more to add
mais lorsqu'il n'y a plus rien à retrancher but when there is no more to cut
-- Antoine de Saint-Exupéry
More information about the Cygwin-apps
mailing list