use of distutils to build a library

build_clib

the only example I've found: https://gist.github.com/fyears/2ed02a8ba5bfc1f34ff22255ab908a95

almost interesting: http://pyopengl.sourceforge.net/pydoc/numpy.distutils.command.build_clib.html

the actual source for build_clib.py: http://coverage.livinglogic.de/Lib/distutils/command/build_clib.py.html

almost some help here: https://wiki.python.org/moin/Distutils/PluginSystem

another source file listing: https://android.googlesource.com/toolchain/python/+/0d4194853e08d3244931523470331c00dfb94863/Python-2.7.3/Lib/distutils/command/build_ext.py

build_ext

https://www.programcreek.com/python/example/64031/distutils.command.build_ext.build_ext

interesting, mentinos makefile: https://data-flair.training/blogs/python-3-extension-programming/

Distutils compiler options configuration (mentions autoconf): https://stackoverflow.com/questions/16077481/distutils-compiler-options-configuration

Automake: this says: https://www.gnu.org/software/automake/manual/html_node/Python.html

pyexecdir

    This is the directory where Python extension modules (shared libraries) should be installed. An extension module written in C could be declared as follows to Automake:

    pyexec_LTLIBRARIES = quaternion.la
    quaternion_la_SOURCES = quaternion.c support.c support.h
    quaternion_la_LDFLAGS = -avoid-version -module

question with no answer: https://stackoverflow.com/questions/20705891/passing-complex-linking-flags-from-makefile-to-setup-py

The $(EXTRA_LDLIBS),$(LDFLAGS) and $(LDLIBS) are generated by configure script. The $(LDLIBS) contains some static libraries some shared.

Note 2: I know I can compile the extension using make, I would prefer setup.py for better deployment.

possible good explanation: https://stackoverflow.com/questions/41169711/python-setuptools-distutils-custom-build-for-the-extra-package-with-makefile

that was good, but this is shorter:

How can I run a Makefile in setup.py? https://stackoverflow.com/questions/1754966/how-can-i-run-a-makefile-in-setup-py

HERE is one with make: https://github.com/Turbo87/py-xcsoar/blob/master/setup.py

now for the tutorial/example

tutoriial: https://packaging.python.org/tutorials/packaging-projects/

somebody's working sample: https://github.com/Turbo87/py-xcsoar/blob/master/setup.py

and putting those together into: /home/wendell/pkgs/python/build_attempts/packaging_tutorial/example_pkg/setup.py

YIPEE!!!

run these:

    python setup.py build
    python setup.py install

then there is:

03:54:10 example_pkg $ ls /home/wendell/usr/local/lib/python3.7/site-packages/
easy_install.py                                  pip-19.0.3.dist-info  README.txt                   spipat-0.9.3-py3.7.egg-info              spipat.py
example_pkg_wendell_turner-0.0.1-py3.7.egg-info  pkg_resources         setuptools                   spipat-0.9.4-py3.7.egg-info
pip                                              __pycache__           setuptools-40.8.0.dist-info  _spipat.cpython-37m-x86_64-linux-gnu.so
03:55:05 example_pkg $ ls /home/wendell/usr/local/lib/python3.7/site-packages/example_pkg_wendell_turner-0.0.1-py3.7.egg-info/
dependency_links.txt  PKG-INFO  SOURCES.txt  top_level.txt