Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] source distributions do not preserve case in keys of setup.cfg #2773

Closed
1 task done
aerusso opened this issue Sep 7, 2021 · 3 comments · Fixed by #2774
Closed
1 task done

[BUG] source distributions do not preserve case in keys of setup.cfg #2773

aerusso opened this issue Sep 7, 2021 · 3 comments · Fixed by #2774
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.

Comments

@aerusso
Copy link
Contributor

aerusso commented Sep 7, 2021

setuptools version

HEAD (58.0.2)

Python version

(irrelevant)

OS

(irrelevant)

Additional environment information

No response

Description

When building a source tar.gz with python -m build, edit_config of setuptools is called to record information about the call in setup.cfg. During the rewrite, the case of the keys in the file is lost -- most notably, options.data_files loses the case of destination paths.

Expected behavior

The case of destination paths is preserved for data_files. More generally, all keys have their case preserved when building source tar.gzs

How to Reproduce

  1. Create a setup.cfg with
[options.data_files]
cAsE=
  file
  file2
  1. touch file file2
  2. python3 -m build

Output

setup.cfg in the tar.gz loses the case: (extract with tar -xf dist/UNKNOWN-0.0.0.tar.gz && cat UNKNOWN-0.0.0/setup.cfg)

[options.data_files]
case = 
        file
        file2

[egg_info]
tag_build = 
tag_date = 0

Code of Conduct

  • I agree to follow the PSF Code of Conduct
@aerusso aerusso added bug Needs Triage Issues that need to be evaluated for severity and status. labels Sep 7, 2021
@jaraco
Copy link
Member

jaraco commented Sep 9, 2021

I confirmed the finding.

Here's the stack when edit_config gets called:

  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/distutils/command/sdist.py", line 473, in make_distribution
    self.make_release_tree(base_dir, self.filelist.files)
  File "/Users/jaraco/code/public/pypa/setuptools/setuptools/command/sdist.py", line 158, in make_release_tree
    self.get_finalized_command('egg_info').save_version_info(dest)
  File "/Users/jaraco/code/public/pypa/setuptools/setuptools/command/egg_info.py", line 195, in save_version_info
    edit_config(filename, dict(egg_info=egg_info))
  File "/Users/jaraco/code/public/pypa/setuptools/setuptools/command/setopt.py", line 40, in edit_config

@jaraco
Copy link
Member

jaraco commented Sep 9, 2021

Configparser converts keys to lowercase unless optionxform = lambda x: x.

@jaraco
Copy link
Member

jaraco commented Sep 9, 2021

Oh, shoot. I just noticed you'd created a PR :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants