python,python3: Add pypi makefile#10242
Conversation
|
This is how I imagine this makefile would be used (using python-six as an example): include $(TOPDIR)/rules.mk
PKG_NAME:=python-six
PKG_VERSION:=1.12.0
PKG_RELEASE:=2
PYPI_NAME:=six
PKG_HASH:=d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73
PKG_LICENSE:=MIT
PKG_LICENSE_FILES:=LICENSE
PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>, Alexandru Ardelean <ardeleanalex@gmail.com>
HOST_BUILD_DEPENDS:=python3/host
include ../pypi.mk
include $(INCLUDE_DIR)/host-build.mk
include $(INCLUDE_DIR)/package.mk
include ../python-package.mk
include ../python3-package.mkThis needs to be included before
Not having I can't believe it took me to so long to think of refactoring these |
| PKG_SOURCE?=$(PYPI_NAME)-$(PKG_VERSION).$(PYPI_SOURCE_EXT) | ||
| PKG_SOURCE_URL?=https://files.pythonhosted.org/packages/source/$(PYPI_NAME_FIRST_LETTER)/$(PYPI_NAME) | ||
|
|
||
| PKG_BUILD_DIR:=$(BUILD_DIR)/pypi/$(if $(BUILD_VARIANT),$(PKG_NAME)-$(BUILD_VARIANT)/)$(PYPI_NAME)$(if $(PKG_VERSION),-$(PKG_VERSION)) |
There was a problem hiding this comment.
curious, would PKG_SOURCE_SUBDIR be better?
There was a problem hiding this comment.
I think PKG_SOURCE_SUBDIR is only used when the source is checked out of a repo (git, svn, etc.), not when it is extracted from a tarball?
I wonder if this interferes with uscan [the tool that emails us telling to upgrade our packages]. |
I'm not sure... @sdwalker do we need to have |
Not for tarballs. |
|
@sdwalker Thanks for clarifying - those email notifications are a life-saver 😂 |
|
I'll admit, I'm a bit fuzzy on how uscan does detection of new packages. Thanks @jefferyto & @sdwalker :) |
|
If placement in a Makefile is a concern, this could be useful to add: https://github.com/openwrt/openwrt/blob/master/include/uclibc%2B%2B.mk#L1 |
|
@commodo I'm glad it occurred to one of us to ask the question 😂 |
|
@neheb I'm not sure I want to stop weird placements, it could be that the makefile author really knows what they are doing or just wants to experiment... Maybe a |
This adds pypi.mk, which can be included in Python packages that download their sources from PyPI, to auto-fill various PKG_* variables based on the value of PYPI_NAME. This makefile should be included after $(TOPDIR)/rules.mk but before $(INCLUDE_DIR)/package.mk (and $(INCLUDE_DIR)/host-build.mk). Signed-off-by: Jeffery To <jeffery.to@gmail.com>
|
Updated with a warning that |
|
Merging. if warning is the wrong approach, there is plenty of time to change before version 20. |
|
Well, 19.07 has already been branched. I wouldn't bother backporting a change like this. It's fairly cosmetic. |
|
I wasn't considering backporting this, but using this in master may make cherry picking changes to the 19.07 branch more difficult. |
|
I wouldn't worry too much about that. |
|
I think we should cherry-pick it to openwrt-19.07 as many packages have been converted and newly added packages can not be included openwrt-19.07 without this. |
|
Go right ahead. It's a cosmetic change anyway. |
|
Here you go- 866b42c. |
Maintainer: me, @commodo
Compile tested: armvirt-64, 2019-10-04 snapshot sdk (tested with python-six, python-twisted)
Run tested: N/A
Description:
This adds
pypi.mk, which can be included in Python packages that download their sources from PyPI, to auto-fill variousPKG_*variables based on the value ofPYPI_NAME.This makefile should be included after
$(TOPDIR)/rules.mkbut before$(INCLUDE_DIR)/package.mk(and$(INCLUDE_DIR)/host-build.mk).Signed-off-by: Jeffery To jeffery.to@gmail.com