0

How can I specify, to a PEP 517 conformant installer, the directories where libraries and scripts should be installed?

Deprecated Setuptools installer does it right

Using python3 -m setup install --install-lib=/usr/share/foo/ --install-scripts=/usr/share/bar/, I can specify the installation location for Python libraries and executable programs.

$ python3 -m setup install --help
[…]
Options for 'install' command:
[…]
  --install-lib                        installation directory for all module
                                       distributions (overrides --install-
                                       purelib and --install-platlib)
[…]
  --install-scripts                    installation directory for Python
                                       scripts
[…]

This is good, when installing a self-contained application; the program files should end up in a location appropriate to the operating system, and the libraries should be installed in an application-private directory because they're not for general import by other Python programs.

The Setuptools project has deprecated the setup install feature, so we need to find a replacement for this.

PEP-517 tools to do this?

The current simple 'build' tool (“A simple, correct Python build frontend”) apparently does not have corresponding options to specify the installation directories that way.

Need a direct replacement for --install-lib and --install-scripts

I want to migrate away from deprecated setup install, to a PEP-517 build system.

But I need (for some applications) to be able to specify the install location of library modules, and of console scripts. Just like with the old --install-lib and --install-scripts options.

How do I instruct 'build' to do this? Or, what other PEP-517 conformant installation tool lets me do this?

bignose
  • 30,281
  • 14
  • 77
  • 110
  • This is not the job of the build tool, but the job of the installer (e.g. pip). – wim Feb 14 '23 at 00:01
  • You probably want the `--prefix` and/or `--target` options to `pip install`. – wim Feb 14 '23 at 00:06
  • If the problem is simply "install the code as an application rather than a reusable package", that is what `pipx` is for. – Karl Knechtel Feb 14 '23 at 00:54
  • Hmm, if you really want to put files to `/usr/share/...` then you should use `.rpm` packaging or similar. Python packaging does not really have the necessary features for an application deployment. – wim Feb 14 '23 at 01:36

0 Answers0