I've recently returned to this issue after a while away. I've ended up with a custom setup.py that runs the external build system as required, and allows pip install/sdist/bdist_wheel to work.
However as a result of all this. i have some general questions. Basically i'm confused about the lack of information that is available on how to write a setup.py for packaging a project. If a project is pure python, or it uses compiled code and it's possible to specify how to build it using the swig/compile/link facilities provided by distutils or setuptools, then it's easy enough to use distutils or setuptools. However if, like me, one needs to use an external build system, it's very difficult to figure out what to do. There seem to be two approaches: Approach 1 is to pass callbacks to distutils.core.setup() or setuptools.setup(). However there doesn't appear to be documentation in either of these modules about what such callbacks should do or how/when they are called. The only way to figure things out seems to be to look at the distutils or setuptools source, which i'm finding pretty opaque. As far as i can tell, callbacks are only given information about the original command line arguments rather than more abstract information such as where to put output files, so distutils and setuptools don't seem to be giving any added value here. Approach 2 is to give up on distutils and setuptools, and instead write setup.py from scratch, directly handling the command-line arguments from pip. Given how fundamental the pip tool is to Python packaging, i was hoping that the command-line arguments that pip passes to setup.py would be standardised and documented, but this doesn't seem to be the case. One can gather some information by running pip commands and have setup.py print out sys.argv, but this is hardly a robust way of doing things. For example there's no guarantee that future versions of pip won't start using different command-line arguments that setuptools already knows about. So as far as i can tell, there are two levels of abstraction at which on can implement customised Python packaging (the setuptools.setup()'s callbacks or the setup.py command line), but neither one seems to be documented or standardised. Is that right? Or am i missing something fundamental here? Many thanks for any help. - Jules On Mon, 14 Dec 2020 13:29:28 -0500 Daniel Holth <dho...@gmail.com> wrote: > You would have to have a high tolerance for learning SCons. I'm aware that > this is not for everyone. Then you could write a SConstruct with dependent > tasks in a normal build system way. e.g. > > target = env.Command("a task", ...) > platlib = env.Whl("platlib", target, root=".") > whl = env.WhlFile(platlib) > > and have each step re-build only when its sources change. > > Here is a stackoverflow answer about custom distutils commands. > https://stackoverflow.com/questions/1710839/custom-distutils-commands > -- http://op59.net -- Distutils-SIG mailing list -- distutils-sig@python.org To unsubscribe send an email to distutils-sig-le...@python.org https://mail.python.org/mailman3/lists/distutils-sig.python.org/ Message archived at https://mail.python.org/archives/list/distutils-sig@python.org/message/77Z7LLYBBW5T4DKCFUTDEG5PM4N5DSIW/