1

I am currently developing a python package that can be installed with setup.py using setuptools. The package uses svn as source control and I am developing on windows. For some files, svn automatically sets the file permissions to write-protected (because of the svn lock mechanism). For example, the package contains a .png file that will be installed with the package and svn always sets the .png file permission to write-protected.

Unfortunately, python -m pip install shows an error when removing the temporary build directory, since it cannot remove the write-protected files (access denied: 'example.png'). I can manually remove the write-protection from the source file and then install the package, which succeeds. However, svn automatically resets the permissions after updating the repository.

Is it possible to configure my setup.py script so that it copies only the file content and uses some default permissions on the target?

My setup.py looks like this. The relevant part that copies the files is the package_data.

import setuptools

setuptools.setup(
    name="my_package",
    version="1.0.0",
    author="Me",
    author_email="example@example.com",
    description="Awesome package",
    classifiers=[
        "Programming Language :: Python :: 3",
        "Operating System :: OS Independent"
    ],
    packages=setuptools.find_packages(),
    package_data={
        "my_package": ["ui/*.png", "ui/*.ui"]
    },
    python_requires=">=3.5",
    install_requires=["pyqt5==5.9"]
)

Edit: Changing the file permissions after copying the files resolved the issue. As hoefling's comment suggests, this answer shows how to do this: https://stackoverflow.com/a/25761434/6095394

pschill
  • 5,055
  • 1
  • 21
  • 42
  • Check whether [this answer](https://stackoverflow.com/a/25761434/2650249) will help. – hoefling Dec 04 '18 at 09:50
  • Yes, changing the permissions after copying the files (as described in your link) seems to work. I think the permission error occurred in a cleanup step when `setuptools` removed the files from the temporary build directory. Should I mark this question as a duplicate? – pschill Dec 04 '18 at 11:21
  • It's up to you. If you could use the answer without any crucial modifications to its code, then it makes sense to mark duplicate as it solves your issue. If not, you may also write an answer to your own question; either way, both questions are linked now. – hoefling Dec 04 '18 at 23:28

0 Answers0