summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Clay <matt@mystile.com>2023-05-01 11:03:10 -0700
committerGitHub <noreply@github.com>2023-05-01 11:03:10 -0700
commit6f4d3a79448a910b24d8fedb76009440551e4265 (patch)
tree227ea0f76b602a1c7a52157e5fb8c20043ce4b12
parentc1e81778084da20f30a8188f0b7d1e0994d4f6f4 (diff)
downloadansible-6f4d3a79448a910b24d8fedb76009440551e4265.tar.gz
Backport setuptools fixes (#80684)
* Use package_data instead of include_package_data (#80652) This resolves warnings generated by setuptools such as the following: _Warning: Package 'ansible.galaxy.data' is absent from the `packages` configuration. (cherry picked from commit 5ac292e12d5e1515beb34028346d76bb68398fc8) * Set the minimum setuptools to 45.2.0 (#80649) Also update the package-data sanity test to use the minimum setuptools version. (cherry picked from commit 4d25e3d54f7de316c4f1d1575d2cf1ffa46b632c)
-rw-r--r--MANIFEST.in14
-rw-r--r--changelogs/fragments/ansible-test-minimum-setuptools.yml2
-rw-r--r--changelogs/fragments/fix-setuptools-warnings.yml2
-rwxr-xr-xhacking/update-sanity-requirements.py14
-rw-r--r--pyproject.toml2
-rw-r--r--setup.cfg47
-rw-r--r--test/sanity/code-smell/package-data.py3
-rw-r--r--test/sanity/code-smell/package-data.requirements.in1
-rw-r--r--test/sanity/code-smell/package-data.requirements.txt1
9 files changed, 67 insertions, 19 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 280d7f111e..f19f64ce3e 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -17,23 +17,9 @@ include examples/hosts
include examples/ansible.cfg
include examples/scripts/ConfigureRemotingForAnsible.ps1
include examples/scripts/upgrade_to_ps3.ps1
-include lib/ansible/keyword_desc.yml
-recursive-include lib/ansible/executor/powershell *.ps1
-recursive-include lib/ansible/module_utils/csharp *.cs
-recursive-include lib/ansible/module_utils/powershell *.psm1
-recursive-include lib/ansible/modules/windows *.ps1
-recursive-include lib/ansible/galaxy/data *.yml *.j2 README.md ansible.cfg inventory .git_keep
-recursive-include lib/ansible/config *.yml
-recursive-include lib/ansible/modules *.yml
-recursive-include lib/ansible/plugins/test *.yml
-recursive-include lib/ansible/plugins/filter *.yml
recursive-include licenses *.txt
recursive-include packaging *.py
recursive-include test/integration *
-recursive-include test/lib/ansible_test/config *.yml *.template
-recursive-include test/lib/ansible_test/_data *.cfg *.in *.ini *.ps1 *.txt *.yml coveragerc
-recursive-include test/lib/ansible_test/_util *.cfg *.ini *.json *.ps1 *.psd1 *.py *.sh *.txt *.yml
-recursive-include test/lib/ansible_test/_util/controller/sanity/validate-modules validate-modules
recursive-include test/sanity *.in *.json *.py *.txt
recursive-include test/support *.py *.ps1 *.psm1 *.cs *.md
exclude test/sanity/code-smell/botmeta.*
diff --git a/changelogs/fragments/ansible-test-minimum-setuptools.yml b/changelogs/fragments/ansible-test-minimum-setuptools.yml
new file mode 100644
index 0000000000..9c7fbeebc7
--- /dev/null
+++ b/changelogs/fragments/ansible-test-minimum-setuptools.yml
@@ -0,0 +1,2 @@
+minor_changes:
+ - The minimum required ``setuptools`` version is now 45.2.0, as it is the oldest version to support Python 3.10.
diff --git a/changelogs/fragments/fix-setuptools-warnings.yml b/changelogs/fragments/fix-setuptools-warnings.yml
new file mode 100644
index 0000000000..7be3f52849
--- /dev/null
+++ b/changelogs/fragments/fix-setuptools-warnings.yml
@@ -0,0 +1,2 @@
+minor_changes:
+ - Use ``package_data`` instead of ``include_package_data`` for ``setup.cfg`` to avoid ``setuptools`` warnings.
diff --git a/hacking/update-sanity-requirements.py b/hacking/update-sanity-requirements.py
index 88569af17a..63eaec786a 100755
--- a/hacking/update-sanity-requirements.py
+++ b/hacking/update-sanity-requirements.py
@@ -45,7 +45,19 @@ class SanityTest:
subprocess.run(pip + ['install', 'wheel'], env=env, check=True) # make bdist_wheel available during pip install
subprocess.run(pip + ['install', '-r', self.source_path], env=env, check=True)
- pip_freeze = subprocess.run(pip + ['freeze'], env=env, check=True, capture_output=True, text=True)
+ keep_setuptools = any(line.startswith('setuptools ') for line in self.source_path.read_text().splitlines())
+
+ exclude_packages = ['pip', 'distribute', 'wheel']
+
+ if not keep_setuptools:
+ exclude_packages.append('setuptools')
+
+ freeze_options = ['--all']
+
+ for exclude_package in exclude_packages:
+ freeze_options.extend(('--exclude', exclude_package))
+
+ pip_freeze = subprocess.run(pip + ['freeze'] + freeze_options, env=env, check=True, capture_output=True, text=True)
requirements = f'# edit "{self.source_path.name}" and generate with: {SELF} --test {self.name}\n{pip_freeze.stdout}'
diff --git a/pyproject.toml b/pyproject.toml
index 482f222190..8a28c0b2ca 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,4 +1,4 @@
[build-system]
-requires = ["setuptools >= 39.2.0"]
+requires = ["setuptools >= 45.2.0"]
backend-path = ["packaging"] # requires 'Pip>=20' or 'pep517>=0.6.0'
build-backend = "pep517_backend.hooks" # wraps `setuptools.build_meta`
diff --git a/setup.cfg b/setup.cfg
index 04e199652a..e020ee3b15 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,4 +1,4 @@
-# Minimum target setuptools 39.2.0
+# Minimum target setuptools 45.2.0
[metadata]
name = ansible-core
@@ -38,13 +38,56 @@ classifiers =
[options]
zip_safe = False
python_requires = >=3.9
-include_package_data = True
# keep ansible-test as a verbatim script to work with editable installs, since it needs to do its
# own package redirection magic that's beyond the scope of the normal `ansible` path redirection
# done by setuptools `develop`
scripts =
bin/ansible-test
+[options.package_data]
+ansible =
+ config/*.yml
+ executor/powershell/*.ps1
+ galaxy/data/*.yml
+ galaxy/data/*/*.j2
+ galaxy/data/*/*.md
+ galaxy/data/*/*/*.cfg
+ galaxy/data/*/*/*.j2
+ galaxy/data/*/*/*.md
+ galaxy/data/*/*/*/*.j2
+ galaxy/data/*/*/*/*.yml
+ galaxy/data/*/*/*/.git_keep
+ galaxy/data/*/*/*/inventory
+ galaxy/data/*/*/.git_keep
+ galaxy/data/*/*/inventory
+ keyword_desc.yml
+ module_utils/csharp/*.cs
+ module_utils/powershell/*.psm1
+ plugins/*/*.yml
+ansible_test =
+ _data/*/*.in
+ _data/*/*.ps1
+ _data/*/*.txt
+ _data/*/*.yml
+ _data/*/*/*.ini
+ _data/ansible.cfg
+ _data/coveragerc
+ _util/*/*/*.ps1
+ _util/*/*/*.py
+ _util/*/*/*.sh
+ _util/*/*/*/*.ini
+ _util/*/*/*/*.json
+ _util/*/*/*/*.ps1
+ _util/*/*/*/*.psd1
+ _util/*/*/*/*.py
+ _util/*/*/*/*.txt
+ _util/*/*/*/*/*.cfg
+ _util/*/*/*/*/*.ps1
+ _util/*/*/*/*/*.py
+ _util/*/*/*/*/*.yml
+ config/*.template
+ config/*.yml
+
# setuptools 51.0.0
# [options.entry_points]
# console_scripts =
diff --git a/test/sanity/code-smell/package-data.py b/test/sanity/code-smell/package-data.py
index ddfdda09a2..c3c4e6e8e2 100644
--- a/test/sanity/code-smell/package-data.py
+++ b/test/sanity/code-smell/package-data.py
@@ -188,9 +188,10 @@ def create_sdist(tmp_dir):
)
stderr = create.stderr
+ stdout = create.stdout
if create.returncode != 0:
- raise Exception('make snapshot failed:\n%s' % stderr)
+ raise Exception('make snapshot failed:\n%s' % stderr + '\n' + stdout)
# Determine path to sdist
tmp_dir_files = os.listdir(tmp_dir)
diff --git a/test/sanity/code-smell/package-data.requirements.in b/test/sanity/code-smell/package-data.requirements.in
index f587e39d21..deb5067889 100644
--- a/test/sanity/code-smell/package-data.requirements.in
+++ b/test/sanity/code-smell/package-data.requirements.in
@@ -5,3 +5,4 @@ pyyaml # ansible-core requirement
resolvelib < 1.1.0
rstcheck < 6 # match version used in other sanity tests
antsibull-changelog
+setuptools == 45.2.0 # minimum supported setuptools
diff --git a/test/sanity/code-smell/package-data.requirements.txt b/test/sanity/code-smell/package-data.requirements.txt
index 393c1a0d1c..c4b6119bf7 100644
--- a/test/sanity/code-smell/package-data.requirements.txt
+++ b/test/sanity/code-smell/package-data.requirements.txt
@@ -10,6 +10,7 @@ PyYAML==6.0
resolvelib==1.0.1
rstcheck==5.0.0
semantic-version==2.10.0
+setuptools==45.2.0
tomli==2.0.1
types-docutils==0.18.3
typing_extensions==4.5.0