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

Add python-git-versioner #1088

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions anda/langs/python/git-versioner/anda.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
project pkg {
rpm {
spec = "python-git-versioner.spec"
}
}
60 changes: 60 additions & 0 deletions anda/langs/python/git-versioner/python-git-versioner.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
%global module git-versioner
%global upstream __version__

Name: python-%{module}
Version: 7.1
Release: %autorelease
Summary: Manage current / next version for project
License: MIT
URL: https://gitlab.com/alelec/%{upstream}
Source: %{url}/-/archive/v%{version}/%{upstream}-v%{version}.tar.gz

BuildArch: noarch
BuildRequires: python3-devel

%global _description %{expand:
Manages the version number for the project based on git tags. The goal
of this packages versioning scheme is to avoid ever needing to manually
create versions numbers or update version details in files that need to
be committed to the repository.

The general rule is:
- If on a tag, report that as-is.
- When changes are made / git commits added, auto-increment the
appropriate level of the semantic version.}

%description %_description

%package -n python3-%{module}
Summary: %{summary}

%description -n python3-%{module} %_description


%prep
%setup -qn %{upstream}-v%{version}
sed -i 's,0.0.0,%{version},' %{upstream}.py
sed -i 's,0.0-new,%{version},' %{upstream}.py
sed -i 's,0.0+new,%{version},' %{upstream}.py
sed -i 's,0.0,%{version},' %{upstream}.py
sed -i 's,on_tag = False,on_tag = True,' %{upstream}.py
sed -i 's,dirty = True,dirty = False,' %{upstream}.py

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files %{upstream}

%check
%pyproject_check_import %{upstream}

%files -n python3-%{module} -f %{pyproject_files}
%{_bindir}/%{module}

%changelog
%autochangelog
1 change: 1 addition & 0 deletions anda/langs/python/git-versioner/update.rhai
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rpm.version(gh_tag("alelec/__version__"));
Loading