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

setup: replace deprecated distutils by setuptools #223

Merged
merged 4 commits into from Oct 24, 2023

Conversation

bdrung
Copy link
Collaborator

@bdrung bdrung commented Sep 27, 2023

Replace deprecated distutils by setuptools:

  • replace distutils.log by logging library
  • drop DistUtilsExtra version check
  • port build_java to setuptools

See also https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html

@codecov
Copy link

codecov bot commented Sep 27, 2023

Codecov Report

Merging #223 (c59fba3) into main (1f4a039) will increase coverage by 0.01%.
The diff coverage is 94.91%.

@@            Coverage Diff             @@
##             main     #223      +/-   ##
==========================================
+ Coverage   82.81%   82.83%   +0.01%     
==========================================
  Files          91       92       +1     
  Lines       18737    18761      +24     
==========================================
+ Hits        15517    15540      +23     
- Misses       3220     3221       +1     
Files Coverage Δ
setup.py 86.95% <100.00%> (-1.59%) ⬇️
setuptools_apport/java.py 94.11% <94.11%> (ø)

@schopin-pro
Copy link
Contributor

The coverage on the new java plugin is pretty poor, I wasn't expecting that!

@bdrung
Copy link
Collaborator Author

bdrung commented Oct 13, 2023

The system-tests-installed should cover the new code. When running the install step in a jammy chroot, build_java and install_java are called, but they are not called in the CI. I fail to find the difference.

`distutils.log` is deprecated. See
https://setuptools.pypa.io/en/latest/deprecated/distutils-legacy.html

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Commit 90046b7 introduced the check for
DistUtilsExtra >= 2.24 in 2011. Since `distutils.version` is deprecated,
drop this version check.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
A future commit will port build_java to a custom setuptools module which
should not be installed. To avoid installing such modules, explicitly
list all packages that should be installed.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
Using distutils directly is deprecated. Port `build_java_subdir` and the
installation of the Java files to a setuptools plugin.

packages needs to be specified for the `setup` call to avoid installing
`setuptools_apport`.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
@bdrung
Copy link
Collaborator Author

bdrung commented Oct 20, 2023

I figured it out: entry-points in setup.py/pyproject.toml are only going to be available for setuptools to use/discover after you install your project. So we have to wire up the java commands directly.

Do not ask me why the initial implementation did work sometimes.

@schopin-pro
Copy link
Contributor

OK, I'll trust you on that one, since I just know enough about setuptools to not wanting to know more about it.

@schopin-pro schopin-pro merged commit 289220f into canonical:main Oct 24, 2023
25 checks passed
@bdrung bdrung deleted the setuptools branch October 24, 2023 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants