$srcdir and $datadir
Victor Porton
porton at narod.ru
Sat Feb 10 09:58:09 EST 2018
First, I've already solved my problem using setuptools and
pkg_resources.resource_stream() and an environment variable to specify the
path to data files.
Ben Finney wrote:
> Victor Porton <porton at narod.ru> writes:
>
>> In GNU software written in C $srcdir and $datadir are accessible to C
>> code through generated config.h file.
>
> For what purpose?
I want my program to work both when it is installed (using $datadir) and
when it is not yet installed (using $srcdir).
> Given that the source may not be at that location after the program is
> compiled – especially, after the program is moved to a different machine
> – what meaning does ‘$srcdir’ have when the program is running?
In GNU system there is support of storing a value (such as source directory)
into the program itself. If it is moved to a different machine, $srcdir
remains the same.
> What “data directory” is specified by ‘$datadir’, and why is it assumed
> there is exactly one?
It may be exactly one, but contain subdirectories.
>> What is the right way to config directories for a Python program?
>
> We'll need to know what those concepts mean, to be able to discuss the
> equivalent (if any) in a Python environment.
--
Victor Porton - http://portonvictor.org
More information about the Python-list
mailing list