[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Allow py-compile to ignore DESTDIR
From: |
Alexandre Duret-Lutz |
Subject: |
Re: Allow py-compile to ignore DESTDIR |
Date: |
Thu, 11 Nov 2004 00:36:56 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
>>> "Toshio" == Toshio <address@hidden> writes:
Toshio> Hi,
Toshio> I've been building RPMS of my python program and found that py-compile
Toshio> is encoding the value of DESTDIR into the byte-compiled .pyc and .pyo
Toshio> files.
Good catch!
Toshio> I put together this small patch to py-compile and
Toshio> python.am to solve this.
The change is large enough to require a copyright assignment to
the FSF before we can include it. Would you be willing to do
that? (I'll mail you the form separately.)
The patch also lacks a ChangeLog entry, and if possible a test
case (proving it works, and ensuring nobody breaks this later).
Toshio> It creates a --destdir [DIR] option to py-compile that
Toshio> complements --basedir. Using --basedir specifies an
Toshio> additional path that is encoded on the beginning of the
Toshio> filenames whereas --destdir specifies an additional
Toshio> path to tack on the front of the filenames only for the
Toshio> purpose of finding the file to compile.
Why not. My preference would be to use --destdir to specify $(DESTDIR)
as in
$(py_compile) --destdir "$(DESTDIR)" --basedir "$(%NDIR%dir)" $$dlist
to avoid the repetition of directories and make the use of
--destdir clearer. But that's not a big deal.
Also it seems an easy way to simplify the python part of the
script is to do
test -n "$destdir" && cd "$destdir" # assuming the above semantics
test -n "$basedir" && cd "$basedir"
before actually running python. Then the python part does not
need to know about $destdir, and probably only the py_compile
line needs to be changed to
py_compile.compile(file, file + 'c', path)
Does this sound correct?
--
Alexandre Duret-Lutz