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