Skip to contentSkip to conversation

Add download helper for PyPi

PATCH New Yegor Yefremov 3 participants 3 messages Jan 2, 2016 – Jan 3, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add download helper for PyPi

PyPi has following URL structure:

https://pypi.python.org/packages/source/{first pkg name char}/{pkg name}

User only needs to pass package name to the helper. The helper itself extracts the first package name character and inserts it into download URL together with package name.

Usage example:

PYTHON_SIX_SITE = $(call pypi,six)

---
 package/pkg-download.mk | 3 +++
 1 file changed, 3 insertions(+)
package/pkg-download.mk +3 -0
index 1332e66..caaeba5 100644
@@ -55,6 +55,9 @@ domainseparator = $(if $(1),$(1),/)
 # github(user,package,version): returns site of GitHub repository
 github = https://github.com/$(1)/$(2)/archive/$(3)
 
+# pypi(package): returns site of PyPi download location
+pypi = https://pypi.python.org/packages/source/$(shell echo $(1) | cut -c1)/$(1)
+
 # Expressly do not check hashes for those files
 # Exported variables default to immediately expanded in some versions of
 # make, but we need it to be recursively-epxanded, so explicitly assign it.
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 Add download helper for PyPi

Quoted 11 lines · Yegor Yefremov

PyPi has following URL structure:

https://pypi.python.org/packages/source/{first pkg name char}/{pkg name}

User only needs to pass package name to the helper. The helper itself extracts the first package name character and inserts it into download URL together with package name.

Usage example:

PYTHON_SIX_SITE = $(call pypi,six)

The reason we introduced this variable for github was that github had changed
the direct URL a few times. For pypi, there is no such problem.

In general, we prefer to keep things explicit, even if that is more verbose.
The $(call pypi,six) is nice and terse, but it makes it more difficult to copy/paste the URL in your browser for instance.

In short, I'm not too fond of this new helper.

Regards,
Arnout

Quoted 21 lines
---
 package/pkg-download.mk | 3 +++
 1 file changed, 3 insertions(+)
package/pkg-download.mk +3 -0
index 1332e66..caaeba5 100644
@@ -55,6 +55,9 @@ domainseparator = $(if $(1),$(1),/)
 # github(user,package,version): returns site of GitHub repository
 github = https://github.com/$(1)/$(2)/archive/$(3)
 
+# pypi(package): returns site of PyPi download location
+pypi = https://pypi.python.org/packages/source/$(shell echo $(1) | cut -c1)/$(1)
+
 # Expressly do not check hashes for those files
 # Exported variables default to immediately expanded in some versions of
 # make, but we need it to be recursively-epxanded, so explicitly assign it.
Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#2 lore raw

PATCH 1/1 Add download helper for PyPi

Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Arnout" == Arnout Vandecappelle <[email protected]> writes:

Quoted 11 lines · Yegor Yefremov

PyPi has following URL structure:

https://pypi.python.org/packages/source/{first pkg name char}/{pkg name}

User only needs to pass package name to the helper. The helper itself extracts the first package name character and inserts it into download URL together with package name.

Usage example:

PYTHON_SIX_SITE = $(call pypi,six)

Quoted 8 lines

The reason we introduced this variable for github was that github had changed
the direct URL a few times. For pypi, there is no such problem.

In general, we prefer to keep things explicit, even if that is more verbose.
The $(call pypi,six) is nice and terse, but it makes it more difficult to copy/paste the URL in your browser for instance.

In short, I'm not too fond of this new helper.

I agree, if it doesn't buy us anything besides a little bit of typing then I also prefer to stay explicit.

Signature · 1 line
Bye, Peter Korsgaard