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

packaging: allow installing without git #4306

Merged
merged 1 commit into from
Aug 7, 2023
Merged

packaging: allow installing without git #4306

merged 1 commit into from
Aug 7, 2023

Conversation

branchvincent
Copy link
Contributor

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run make lint?
  • Have you successfully run pytest tests/unit?

Related to #4145

This allows building/installing snapcraft from non-git clones. It would be useful to Homebrew, as we prefer to build from lightweight tarballs.
If git describe fails, it first checks if the version is defined in the environment via SNAP_VERSION or falls back to a PEP440-compliant version string 0.0.0+devel (this is similar to the fallback in snapcraft/__init__.py, but updated for PEP440).

Before:

$ pip3 install https://github.com/snapcore/snapcraft/archive/refs/tags/7.5.0.tar.gz
...
      subprocess.CalledProcessError: Command '['git', 'describe', '--always', '--long']' returned non-zero exit status 128.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
...

After:

$ pip3 install https://github.com/branchvincent/snapcraft/archive/refs/heads/build-no-git.tar.gz
...
Successfully installed snapcraft-0.0.0+devel
$ pip3 uninstall -y snapcraft
$ SNAP_VERSION=7.5.0 pip3 install https://github.com/branchvincent/snapcraft/archive/refs/heads/build-no-git.tar.gz
...
Successfully installed snapcraft-7.5.0

@sergiusens
Copy link
Collaborator

thank you for this!

@codecov-commenter
Copy link

codecov-commenter commented Aug 7, 2023

Codecov Report

Merging #4306 (c9ae8d8) into main (91a18b3) will not change coverage.
The diff coverage is n/a.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@           Coverage Diff           @@
##             main    #4306   +/-   ##
=======================================
  Coverage   89.08%   89.08%           
=======================================
  Files         300      300           
  Lines       20571    20571           
=======================================
  Hits        18325    18325           
  Misses       2246     2246           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sergiusens sergiusens changed the title build: allow installing without git packaging: allow installing without git Aug 7, 2023
@sergiusens sergiusens merged commit f3ee96a into canonical:main Aug 7, 2023
11 checks passed
@branchvincent branchvincent deleted the build-no-git branch October 11, 2023 20:12
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.

3 participants