Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197655 > unrolled thread

Annoyance building python from source

Started byKeith Thompson <Keith.S.Thompson+u@gmail.com>
First post2025-12-29 20:16 -0800
Last post2025-12-31 14:47 -0800
Articles 2 — 1 participant

Back to article view | Back to comp.lang.python


Contents

  Annoyance building python from source Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-29 20:16 -0800
    Re: Annoyance building python from source Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2025-12-31 14:47 -0800

#197655 — Annoyance building python from source

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2025-12-29 20:16 -0800
SubjectAnnoyance building python from source
Message-ID<87o6ngvc32.fsf@example.invalid>
When I build Python from source, the "sudo make install" step
creates root-owned files in the build directory.  I have not seen
this while building other open-source packages from source.

Is there a way to avoid this, so no root-owned files are creates
other than under the target installation directory?

The details:

I typically build Python from a cloned git directory.  The steps
(leaving out some irrelevant details) are:

    git clone https://github.com/python/cpython
    cd cpython
    git switch -d VERSION
    ./configure
    make
    sudo make install

The last step creates dozens of *.pyc files under the cpython/Lib
directory.

I've recently started doing builds in a temporary subdirectory:

    ...
    mkdir BUILD_DIR
    cd BUILD_DIR
    ../configure
    make
    sudo make install

That does create a lot of files under BUILD_DIR, but I still get
a lot of root-owned *.pyc files under the cpython/Lib directory.

I have to run some command under sudo ("sudo rm ..." or "sudo git clean
...") to remove these *.pyc files before doing a new clean build, which
is a mild annoyance.

Without having looked into the details, I would have expected these
*.pyc files to be created by `make`, not by `sudo make install`,
but perhaps there are good reasons for the way it's done.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [next] | [standalone]


#197656

FromKeith Thompson <Keith.S.Thompson+u@gmail.com>
Date2025-12-31 14:47 -0800
Message-ID<87bjjew9nw.fsf@example.invalid>
In reply to#197655
Keith Thompson <Keith.S.Thompson+u@gmail.com> writes:
> When I build Python from source, the "sudo make install" step
> creates root-owned files in the build directory.  I have not seen
> this while building other open-source packages from source.
>
> Is there a way to avoid this, so no root-owned files are creates
> other than under the target installation directory?
[...]

I received a reply on the python-list mailing list that didn't appear
here.  I can't post to python-list without joining it.

The reply suggested not using "sudo" for "make install".

That could be a workaround, but: 

- I install into a directory owned by root,
- It's easier to use sudo to clean up the generated files, and
- for all the other things I build from source (Python, Ruby, gcc,
  etc.), "sudo make install" doesn't create any root-owned files in
  the source directory; Python's build seems to be unique. 

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web