[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Allow py-compile to ignore DESTDIR

From: Toshio
Subject: Re: Allow py-compile to ignore DESTDIR
Date: Sat, 13 Nov 2004 13:59:43 -0500

On Thu, 2004-11-11 at 00:36 +0100, Alexandre Duret-Lutz wrote:
> >>> "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> 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.)
I put in the request.  I should be getting a form in the mail soon.

> The patch also lacks a ChangeLog entry, and if possible a test
> case (proving it works, and ensuring nobody breaks this later).
I'll create a test and ChangeLog this week.

>  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.
I'll implement this too.  It makes sense to implement it this way.

> 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?

I think destdir with the above semantics would work that way.  But my
impression is basedir is being passed in so it can be added to the
python file.  Otherwise, I could just change how the current --basedir
is implemented so that it is done outside of the py_compile.compile().
Is this impression wrong?

Toshio <address@hidden>

Attachment: signature.asc
Description: This is a digitally signed message part

reply via email to

[Prev in Thread] Current Thread [Next in Thread]