I'm packaging with a small module named my_module; the build is described by a setup.cfg / setup.py pair. Those files are read-only (as they are monitored by a version controler that mark all files as read-only unless explicitely marked for edit).
The setup.cfg file looks like:
[metadata]
name = my_module
...
[options]
package_dir =
= src
packages = find:
python_requires = >=3.6
install_requires =
...
[options.packages.find]
where = src
And the module tree is the following:
my_module_folder/
setup.cfg
setup.py
src/
my_module/
__init__.py
...
sdist-ing it yields the following:
$ python3 setup.py sdist
running sdist
running egg_info
writing src/my_module.egg-info/PKG-INFO
writing dependency_links to src/my_module.egg-info/dependency_links.txt
writing requirements to src/my_module.egg-info/requires.txt
writing top-level names to src/my_module.egg-info/top_level.txt
reading manifest file 'src/my_module.egg-info/SOURCES.txt'
writing manifest file 'src/my_module.egg-info/SOURCES.txt'
running check
creating my_module-1.0.0
creating my_module-1.0.0/src
...
copying files to my_module-1.0.0...
copying setup.cfg -> my_module-1.0.0 # here
copying setup.py -> my_module-1.0.0
copying src/my_module/__init__.py -> my_module-1.0.0/src/my_module
...
Writing my_module-1.0.0/setup.cfg # and there
error: [Errno 13] Permission denied: 'my_module-1.0.0/setup.cfg'
Note that at some point, setuptools will copy the read-only setup.cfg into the package, then later attempt to overwrite it to add an "[egg_info]" section:
[egg_info]
tag_build =
tag_date = 0
Of course that can only fails since setup.cfg was copied with its read-only attribute...
I could harshly alter permissions or file mask prior doing the build, in the setup.py, but I am looking for a more elegant solution. Any clue?