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

Use version manually in setup.py when provided (infra) #1253

Merged
merged 1 commit into from
May 22, 2024

Conversation

Hook25
Copy link
Collaborator

@Hook25 Hook25 commented May 22, 2024

Description

By default we adopt the package version via setuptools scm. This tool reads the SETUPTOOLS_SCM_PRETEND_VERSION environment variable and, if it is provided, it adopts it as the version without doing any further calculation. This is useful to pre-compute the version before building like we do in snaps and debs. This mechanism seems to not be used on some versions of pybuild (the debian plugin we use to build the package) that ignores the setuptools-scm version and simply uses a 0.0.0 version string.

This PR adopts the version from the variable in setup.py manually. Note that if the variable is not provided setuptools-scm is still used, preserving the functionality of "source" installs.

Resolved issues

Fixes: https://warthogs.atlassian.net/browse/CHECKBOX-1444
Fixes: #1250

Documentation

This also adds a comment to explain why this is done.

Tests

To try this start a lxd container and build the package:

$ add-apt-repository ppa:checkbox-dev/edge
$ apt update
$ apt install dpkg-dev
$ cd checkbox
$ mv checkbox-ng/debian .  
$ dpkg-buildpackage -S
[...]  # this it will complain about missing build deps
$ apt install debhelper dh-python pybuild-plugin-pyproject python3-all python3-distutils-extra python3-docutils python3-importlib-metadata python3-packaging python3-padme python3-psutil python3-requests-oauthlib python3-setuptools python3-setuptools-scm python3-sphinx python3-tk python3-tqdm python3-urwid python3-xlsxwriter
$ dpkg-buildpackage -S
$ dpkg-buildpackage -b
$ cd ..
$ dpkg -i python3-checkbox-ng_2.8_all.deb checkbox-ng_2.8_all.deb

To verify that all went well run:

$ checkbox-cli --version
2.8

Note: the version is adopted from the debian changelog that is automatically updated by launchpad. Locally the version will always be 2.8 (as that is the last version that was "manually" updated).

@Hook25 Hook25 force-pushed the fix_deb_versions branch from e682c6a to 16eaf7d Compare May 22, 2024 14:50
Copy link

codecov bot commented May 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 43.38%. Comparing base (ba754d6) to head (16eaf7d).
Report is 122 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1253   +/-   ##
=======================================
  Coverage   43.37%   43.38%           
=======================================
  Files         357      357           
  Lines       38693    38686    -7     
  Branches     6561     6561           
=======================================
  Hits        16784    16784           
+ Misses      21245    21238    -7     
  Partials      664      664           
Flag Coverage Δ
checkbox-ng 67.54% <ø> (ø)
checkbox-support 52.22% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@fernando79513 fernando79513 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1!

@fernando79513 fernando79513 merged commit ec16636 into main May 22, 2024
25 checks passed
@fernando79513 fernando79513 deleted the fix_deb_versions branch May 22, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

checkbox-cli --version return 0 on 18.04
2 participants