Preserving file permissions with distutils

Discussion in 'Python' started by George Sakkis, Jan 14, 2009.

  1. I'm trying to use distutils to install some package data and
    additional files, some of which may be executable. It turns out that
    distutils does not preserve the permissions. Digging in the code,
    there is the following comment on distutils/command/build_py:

    # XXX copy_file by default preserves mode, which appears to be
    the
    # wrong thing to do: if a file is read-only in the working
    # directory, we want it to be installed read/write so that the
    next
    # installation of the same module distribution can overwrite
    it
    # without problems. (This might be a Unix-specific issue.)
    Thus

    If the only reason for not preserving the mode is ensuring it's read/
    write, why not preserve the rest permissions and set the write flag
    for the owner ? The comment continues:

    # we turn off 'preserve_mode' when copying to the build
    directory,
    # since the build directory is supposed to be exactly what the
    # installation will look like (ie. we preserve mode when
    # installing).

    But installing copies from the build dir which has forgotten the
    original permissions, so there is no actual preservation! Am I reading
    this wrong or should I submit a bug report ?

    George
     
    George Sakkis, Jan 14, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. timw.google
    Replies:
    1
    Views:
    563
    Serge Orlov
    May 11, 2006
  2. TTroy
    Replies:
    16
    Views:
    815
    Peter Nilsson
    Jan 31, 2005
  3. Andrew Koenig
    Replies:
    1
    Views:
    283
    =?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?=
    Apr 12, 2007
  4. Replies:
    4
    Views:
    565
  5. Luis Alberto Zarrabeitia Gomez

    distutils, No module named numpy.distutils.fcompiler.conv_template

    Luis Alberto Zarrabeitia Gomez, Mar 30, 2009, in forum: Python
    Replies:
    0
    Views:
    1,365
    Luis Alberto Zarrabeitia Gomez
    Mar 30, 2009
Loading...

Share This Page