Commit graph

38 commits

Author SHA1 Message Date
d0c1eac1a9 py-defs.mk, py-mod.mk: Support PY_UPDATE_INIT_PY
Allow to disable auto-updating of __init__.py in a directory via
PY_UPDATE_INIT_PY = true | false.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-16 18:42:58 +01:00
0a9340af49 make: Re-add files necessary for building jw-python
Re-add everything necessary for building and packaging jw-python.

ldlibpath.mk is not strictly necessary, but might be with other
Python packages backed by compiled C-code, so leave it in.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-13 17:27:14 +01:00
bc883deed4 Everywhere: Remove everything non-essential for "make clean all"
This commit removes everything not strictly necessary for running
"make clean all" inside jw-build.

packaging jw-devtest. This cuts the repo down from 24077 to 4725
lines of code.

The idea is to

1) Further remove bloat from the remaining bits

2) Re-add what's necessary to build and package other essential repos.

   The decision should be based on whether or not jw-build can also be
   useful in a non-janware context.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-14 15:02:56 +01:00
cb714d83ad py-devs.mk: Don't ?= PYTHONPATH
For performance's sake, don't ?= define PYTHONPATH, but := it, like
so:

  ifeq ($(origin PYTHONPATH),undefined)
    PYTHONPATH := $(call proj_query, pythonpath $(PROJECT) $(PY_PREREQ_RUN))
  endif

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-11-13 15:20:54 +01:00
a907a5640f py-defs.mk: Support PY_INSTALL[_XXX]
Support the Makefile variables PY_INSTALL, PY_INSTALL_REG, PY_INSTALL_PYC, all
defaulting to true. They can be set to false to stop installation of whatever
file type is undesired in the target. A common use case for this are
__init__.cpython-313.pyc, provided by a package the installing package depends
on. The prerequisite package might already provide these files for common
directories.

Signed-off-by: Jan Lindemann <jan@janware.com>
2025-07-16 16:21:35 +00:00
60ef137bc3 projects.mk, py-defs.mk, py-version.mk: Add py-version.mk
This commit adds py-version.mk, eliminating redundancy between projects.mk and
py-defs.mk in setting up the Python version early.
2025-02-22 09:04:17 +00:00
9a5bc11cd0 py-defs.mk: Fix: mypy finds modules unter multiple paths
Signed-off-by: Jan Lindemann <jan@janware.com>
2024-06-04 08:56:19 +00:00
17851c9d11 projects.mk / py-defs.mk: Support Python 3.10
The current globbing pattern for filling the PYTHON variable doesn't
account for the fact that /usr/bin/python3.X might have more than one
digit for X, fix that

Signed-off-by: Jan Lindemann <jan@janware.com>
2022-10-04 11:05:24 +00:00
f3febfa460 py-defs.mk, projects.mk: Fix /usr/bin/python globbing on OpenSUSE
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-05-18 13:15:35 +00:00
caf33841b4 py-defs.mk, projects.mk: Use latest install Python
Use $(lastword $(shell ls -v /usr/bin/python[0-9]*)) for the Python version to use.

Signed-off-by: Jan Lindemann <jan@janware.com>
2020-05-16 13:22:51 +00:00
a82fa9023b py-xxx.mk: Introduce PYTHON_MAJOR
Where *.pyc files are created is decided by PYTHON_MAJOR, not PYTHON_VERSION,
so introduce it.

Signed-off-by: Jan Lindemann <jan@janware.com>
2020-05-16 13:09:16 +00:00
fab119fca9 py-defs.mk: Add MYPYPATH to py-libpath target
Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-26 19:04:18 +00:00
a404be15b9 make, scripts: Add support for static Python typechecking
This commit adds support for static typechecking with mypy.

Notable additions:

  - A new target "check" which does the type checking

  - Py-mods.mk, meant to be included from a directory containing python modules
    in subdirectories, but not being a python module itself. It makes the all
    target depend on check only if PY_RUN_CHECK_AFTER_BUILD is defined and
    true.  That's because pypy is under heavy development, and the Ubuntu 18.04
    version is too old to work for lots of the code.

Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-10 12:13:12 +00:00
d8542717b1 py-defs.mk: Add PY_PREREQ_RUN in PYTHONPATH
This allows to specify modules in a test directory which a given module does
_not_ depend on and doesn't want to depend on.

Signed-off-by: Jan Lindemann <jan@janware.com>
2020-04-05 12:51:08 +00:00
921a929cd3 Ubuntu: Fix PY_SITE_PACKAGES_PATH
PY_SITE_PACKAGES_PATH is set to the first element site.getsitepackages(), which
(correctly, but in this case undesirably) is below /usr/local. Use the first
path which is not.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-11-13 12:49:27 +00:00
9f0276ead5 py-defs.mk: Fix clean target
pyc.clean was broken because it did rm -f __pycache__ (a directory)
Also, add include guards.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-10-28 12:20:50 +00:00
b2d6e6f554 Everywhere: Rename MODDIR -> JWBDIR
Rename the omnipresent MODDIR variable to JWBDIR, since that's more to the
point.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-29 21:34:18 +00:00
386f9304c6 py-defs.mk: Add automatic detection of PY_CPYTHON_PREFIX
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-11 08:47:46 +00:00
ab5fc0c334 py-defs.mk: Fix installation with predefined PY_INSTALL_DIR
Predefined PY_INSTALL_DIR was ignored prior to this commit, which shuffles the
py-defs.mk variables around considerably. Still some temporary variables
unnecessarily defined with ?=, but some testing would be good prior to further
changes.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-11 08:31:11 +00:00
4e9be149ef py-defs.mk: Fix PY_INSTALL_XXX_MOD generation
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-09 06:24:43 +00:00
956aea82eb py-*.mk: Fix python version detection
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-03 08:00:39 +00:00
13fa28e23f make, scripts: Flip some more switches from pathon 2 to 3 (untested!)
This commit flips some more switches from Python 2 to Python 3 in makefiles and
Python code. Build runs through, but it's still likely to break things.

Signed-off-by: Jan Lindemann <jan@janware.com>
2019-06-02 12:28:13 +00:00
fe161ff4d6 py-defs.mk, py-mod.mk: Add support for Python3's __pycache__
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-12 11:35:49 +00:00
aa85417a17 Everywhere: Purge spaces in text files
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-06 12:38:20 +00:00
0eaef0c326 conf/jcs, make, tmpl/doxygen: Align equal signs in makefiles to column 30
Signed-off-by: Jan Lindemann <jan@janware.com>
2019-03-03 18:12:28 +00:00
ed8b3918cc py-defs.mk: Allow PY_INSTALL_DIR to be overridden (?=)
Signed-off-by: Jan Lindemann <jan@janware.com>
2018-12-28 13:46:23 +00:00
e68d4eb83b make, scripts: Now excplicitly calling python2 executable instead of python
Signed-off-by: Jan Lindemann <jan@janware.com>
2018-01-02 13:12:00 +00:00
6bfa55481c make: Speed up clean targets
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-12-27 11:43:01 +00:00
f70465cbd5 make: Replace pwd by $(PWD)
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-12-18 13:45:55 +00:00
3dddce9817 py-defs.mk: Add multiple inclusion preventer
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-11-23 08:41:46 +00:00
2594143b1f make: Improvements to a couple of makefiles
- Depend.mk, ldlibpath.mk:
  add multiple inclusion guards
- Flex-bison.mk
  some dependency fiddling
- Py-defs.mk:
  remove *.pyc on clean

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-10-30 12:02:43 +00:00
db1e6097fa ldlibpath.mk, py-defs.mk, rules.mk: Add ldlibpath.mk to py-defs.mk
Since python might need bound C libraries, too, this
looks like a good idea.

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-08-01 21:53:36 +00:00
ad2c1da54a py-defs.mk: Add (disabled) support for python3
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-26 09:45:54 +00:00
3f782d3f3f py-defs/py-mod.mk: Fix __init__.py generation
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-25 15:04:44 +00:00
55f9b50562 py-defs.mk, py-mod.mk, python-tools.sh: Improve python module handling
- Fix superflous dots in module names
- Generate PYTHONPATH in projects.py
- Add support for __init__.py.tmpl

Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-24 10:59:08 +00:00
cdabaad7ef py-*.mk: Fill PYTHONPATH from build dependencies
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-22 18:16:08 +00:00
f8747fcdbd py-defs.mk, py-mod.mk: Add exports to __init__.py
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-22 14:34:23 +00:00
d49340917b make: Add py-defs.mk py-mod.mk py-run.mk
Signed-off-by: Jan Lindemann <jan@janware.com>
2017-07-21 15:34:16 +00:00