python: Add pypi.mk usage to readme
authorJeffery To <redacted>
Mon, 4 Nov 2019 19:28:12 +0000 (03:28 +0800)
committerJeffery To <redacted>
Mon, 4 Nov 2019 19:28:12 +0000 (03:28 +0800)
This adds documentation on including pypi.mk and its required/optional
variables to the Python section readme.

Signed-off-by: Jeffery To <redacted>
lang/python/README.md

index c6bbd20a85d65970cff613a5eeb71a29da593997..94b2afaf60423137bd2b60708747ff060bcb2488 100644 (file)
@@ -187,6 +187,43 @@ Order doesn't matter between `python-package.mk` & `python3-package.mk`.
 
 These will make sure that build rules for Python or Python3 can be specified and picked up for build.
 
+### Include pypi.mk (optional)
+
+If the package source code will be downloaded from [pypi.org](https://pypi.org/), including `pypi.mk` can help simplify the package Makefile.
+
+To use `pypi.mk`, add this **before** `include $(INCLUDE_DIR)/package.mk`:
+```
+include ../pypi.mk
+```
+
+`pypi.mk` has several `PYPI_*` variables that must/can be set (see below); these should be set before `pypi.mk` is included, i.e. before the `include ../pypi.mk` line.
+
+`pypi.mk` also provides default values for `PKG_SOURCE` and `PKG_SOURCE_URL`, so these variables may be omitted.
+
+One variable is required:
+
+* `PYPI_NAME`: Package name on pypi.org. This should match the PyPI name exactly.
+
+  For example (from the `python-yaml` package):
+  ```
+  PYPI_NAME:=PyYAML
+  ```
+
+These variables are optional:
+
+* `PYPI_SOURCE_NAME`: Package name component of the source tarball filename  
+  Default: Same value as `PYPI_NAME`
+
+* `PYPI_SOURCE_EXT`: File extension of the source tarball filename  
+  Default: `tar.gz`
+
+`pypi.mk` constructs the default `PKG_SOURCE` value from these variables (and `PKG_VERSION`):
+```
+PKG_SOURCE?=$(PYPI_SOURCE_NAME)-$(PKG_VERSION).$(PYPI_SOURCE_EXT)
+```
+
+The `PYPI_SOURCE_*` variables allow this default `PKG_SOURCE` value to be customized as necessary.
+
 ### Add Package/<PKG_NAME> OpenWrt definitions
 
 This part is similar to default OpenWrt packages.
git clone https://git.99rst.org/PROJECT