summaryrefslogtreecommitdiff
path: root/setuptools/config/expand.py
Commit message (Collapse)AuthorAgeFilesLines
* Use new warnings in setuptools/config/expand.pyAnderson Bravalheri2023-03-071-2/+2
|
*-. Merge PRs #3636 #3634 #3633 #3595 #3576 #3569 #3564Anderson Bravalheri2022-10-141-1/+2
|\ \
| * | Use abspath() instead of resolve() in expand._assert_local()Mike Salvatore2022-09-221-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4249da1ecf uses `pathlib.Path.resolve()` instead of `os.path.abspath()` to canonicalize path names. `resolve()` resolves symlinks, whereas `abspath()` does not. `resolve()` can also raise a `RuntimeError` if infinite loops are discovered while resolving the path. There is some concern that using `resolve()` would not be backwards compatible. This commit switches back to `abspath()` but still uses `Path.parents` to avoid the edge case. See PR #3595 for more details.
| * | Catch an edge case in expand._assert_local()Mike Salvatore2022-09-181-1/+4
| |/ | | | | | | | | | | | | | | | | | | | | | | | | Using str.startswith() has an edge case where someone can access files outside the root directory. For example, consider the case where the root directory is "/home/user/my-package" but some secrets are stored in "/home/user/my-package-secrets". Evaluating a check that "/home/user/my-package-secrets".startswith("/home/user/my-package") will return True, but the statement's intention is that no file outside of "/home/user/my-package" can be accessed. Using pathlib.Path.resolve() and pathlib.Path.parents eliminates this edge case.
* | Use pathlib to open the fileJason R. Coombs2022-09-291-3/+2
| |
* | expand: Give bytes to ast.parse to let it discover encoding cookie.Julien Palard2022-09-271-1/+1
|/
* Merge remote-tracking branch 'upstream/main' into feature/pep660Anderson Bravalheri2022-06-241-14/+12
|\
| * config.expand.StaticModule: handle scenarios when annotated assignment does ↵Anderson Bravalheri2022-06-191-2/+2
| | | | | | | | not have a value
| * config.expand: Refactor StaticModuleAnderson Bravalheri2022-06-191-13/+12
| |
| * Add support for annotated assignments to static attribute lookup.Karl Otness2022-06-181-16/+13
| | | | | | | | | | | | | | | | When walking the ast of a module, look for AnnAssign nodes in addition to Assign to support assignments with type annotations, for example. Since we have to read different attributes, split the generators into a for loop. Existing ast.Assign nodes follow the same processing as before.
| * Clarify modules used for pyproject.toml parsing are privateAnderson Bravalheri2022-06-171-0/+2
| |
* | build_meta: Allow dist-info and egg-info to coexistAnderson Bravalheri2022-06-211-19/+2
|/ | | | | | | PEP 517 does not care if other directories/files are left behind in the `metadata_directory`, as long as a `.dist_info` directory is produced at the root. We can leave the `.egg-info` directory behind, so this way we don't have to run it again when listing files from `build_py`.
* Rename variableAnderson Bravalheri2022-04-051-4/+4
|
* Simplify auto-discovered package_dirAnderson Bravalheri2022-04-051-2/+25
| | | | | | | | If the directory follows a src-layout-ish, try harder to make `package_dir` in the form `{"": "src"}`. This might be later important for PEP 660 (e.g. when composing pth files or symlinking the toplevel packages).
* Make sure dynamic classifiers in pyproject.toml don't fail (#3210)Anderson Bravalheri2022-03-251-5/+13
|\
| * Make sure dynamic classifiers don't fail on unexisting filesAnderson Bravalheri2022-03-251-5/+13
| |
* | Avoid unnecessarily changing package_dirAnderson Bravalheri2022-03-251-12/+12
|/ | | | And also avoid using './' paths
* Fix edge case of package discoveryAnderson Bravalheri2022-03-241-1/+2
|
* Improve interaction between pyproject.toml metadata and discoveryAnderson Bravalheri2022-03-211-13/+59
|
* Refactor function for finding top-level packages in auto-discoveryAnderson Bravalheri2022-03-181-18/+3
|
* Make sure package_dir is populated before processing cmdclass and 'attr:' in ↵Anderson Bravalheri2022-03-091-1/+45
| | | | setup.cfg
* Allow expand.find_packges to fill package_dirAnderson Bravalheri2022-03-091-4/+42
|
* Import package finders directly from discovery moduleAnderson Bravalheri2022-03-091-2/+2
|
* Find namespaces by default when using config in 'pyproject.toml'Anderson Bravalheri2022-03-051-1/+1
|
* Add some type hints to config.expandAnderson Bravalheri2022-03-051-26/+52
|
* Expand dynamic entry_points from pyproject.tomlAnderson Bravalheri2022-03-051-0/+16
| | | | | | | | | | | The user might specify dynamic `entry-points` via a `file:` directive (a similar feature for `setup.cfg` is documented in [declarative config]). The changes introduced here add the ability to expand them when reading the configuration from `pyproject.toml`. [declarative config]: https://setuptools.pypa.io/en/latest/userguide/declarative_config.html
* Adopt review suggestionsAnderson Bravalheri2022-03-051-4/+2
| | | | Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
* Split complex generator expression in setuptools.config.expandAnderson Bravalheri2022-03-051-5/+13
|
* Allow single strings in config.expand.read_filesAnderson Bravalheri2022-03-051-0/+3
|
* Allow root_dir to be explicit in config.expand functionsAnderson Bravalheri2022-03-051-52/+88
|
* Extract post-processing functions from configAnderson Bravalheri2022-03-051-0/+249
We can split the process of interpreting configuration files into 2 steps: 1. The parsing the file contents from strings to value objects that can be understand by Python (for example a string with a comma separated list of keywords into an actual Python list of strings). 2. The expansion (or post-processing) of these values according to the semantics ``setuptools`` assign to them (for example a configuration field with the ``file:`` directive should be expanded from a list of file paths to a single string with the contents of those files concatenated) The idea of this change is to extract the functions responsible for (2.) into a new module, so they can be reused between different config file formats.