$srcdir and $datadir

Ben Finney ben+python at benfinney.id.au
Sat Feb 10 18:49:09 EST 2018


Victor Porton <porton at narod.ru> writes:

> I want my program to work both when it is installed (using $datadir)
> and when it is not yet installed (using $srcdir).

Given your descriptions of both those, I don't see how it can reliably
work; the program will expect directories that may not exist. Why
hard-code them at all, then?

So, I am going to have to ignore the “$srcdir and $datadir” specifics,
and address the stated intent.

The current convention in Python build systems is the Setuptools
library. You will be familiar with the ‘setup.py’ top-level script for
co-ordinating Setuptools actions on a code base.

The installation tool ‘pip’ works with Setuptools data. Use it to
install your distribution from PyPI for production use; use it to
install your code base from local directories for testing; use it with
special options to “install” your code in a development mode while you
work on it.

    <URL:https://pip.pypa.io/en/stable/reference/pip_install/#usage>
    <URL:https://pip.pypa.io/en/stable/reference/pip_install/#editable-installs>

-- 
 \        “Always code as if the guy who ends up maintaining your code |
  `\     will be a violent psychopath who knows where you live.” —John |
_o__)                                                         F. Woods |
Ben Finney




More information about the Python-list mailing list