!7 修复python-packaging升级导致的编译失败
From: @lyn1001 Reviewed-by: @wang--ge Signed-off-by: @wang--ge
This commit is contained in:
commit
1fcc698932
62
Handle-removed-packaging.version.LegacyVersion.patch
Normal file
62
Handle-removed-packaging.version.LegacyVersion.patch
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
From d53cf4b7b29204f34c65a875860e61e04fae98ec Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Dirk=20M=C3=BCller?= <dirk@dmllr.de>
|
||||||
|
Date: Thu, 5 Jan 2023 09:46:40 +0100
|
||||||
|
Subject: [PATCH] handle removed packaging.version.LegacyVersion (Fixes #83)
|
||||||
|
sync from https://github.com/openSUSE/obs-service-set_version/commit/d53cf4b7b29204f34c65a875860e61e04fae98ec
|
||||||
|
|
||||||
|
This also makes it python 3.x specific, which should be fine
|
||||||
|
---
|
||||||
|
set_version | 15 +++++++++++----
|
||||||
|
1 file changed, 11 insertions(+), 4 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/set_version b/set_version
|
||||||
|
index d2a6925..58882c9 100755
|
||||||
|
--- a/set_version
|
||||||
|
+++ b/set_version
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!/usr/bin/python
|
||||||
|
+#!/usr/bin/python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
# A simple script to update version number in spec, dsc or arch linux files
|
||||||
|
@@ -15,6 +15,7 @@
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
+from contextlib import suppress
|
||||||
|
import glob
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
@@ -26,7 +27,7 @@ import codecs
|
||||||
|
import logging
|
||||||
|
|
||||||
|
try:
|
||||||
|
- from packaging.version import LegacyVersion, Version, parse
|
||||||
|
+ from packaging.version import Version, parse
|
||||||
|
except ImportError:
|
||||||
|
HAS_PACKAGING = False
|
||||||
|
import warnings
|
||||||
|
@@ -35,6 +36,9 @@ except ImportError:
|
||||||
|
else:
|
||||||
|
HAS_PACKAGING = True
|
||||||
|
|
||||||
|
+if HAS_PACKAGING:
|
||||||
|
+ with suppress(ImportError):
|
||||||
|
+ from packaging.version import LegacyVersion
|
||||||
|
|
||||||
|
if os.environ.get('DEBUG_SET_VERSION') == "1":
|
||||||
|
logging.getLogger().setLevel(logging.DEBUG)
|
||||||
|
@@ -351,8 +355,11 @@ def _version_python_pip2rpm(version_pip):
|
||||||
|
v_rpm = v_rpm.replace('rc', '~xrc')
|
||||||
|
v_rpm = v_rpm.replace('.dev', '~dev')
|
||||||
|
version_rpm = v_rpm
|
||||||
|
- elif isinstance(v, LegacyVersion):
|
||||||
|
- # TODO(toabctl): handle setuptools style legacy version
|
||||||
|
+ else:
|
||||||
|
+ with suppress(NameError):
|
||||||
|
+ if isinstance(v, LegacyVersion):
|
||||||
|
+ # TODO(toabctl): handle setuptools style legacy version
|
||||||
|
+ pass
|
||||||
|
pass
|
||||||
|
|
||||||
|
return version_rpm
|
||||||
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
Name: obs-service-set_version
|
Name: obs-service-set_version
|
||||||
Version: 0.5.14
|
Version: 0.5.14
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Set the version in spec
|
Summary: Set the version in spec
|
||||||
License: GPL-2.0-or-later
|
License: GPL-2.0-or-later
|
||||||
Group: Development/Tools/Building
|
Group: Development/Tools/Building
|
||||||
@ -8,6 +8,7 @@ URL: https://github.com/openSUSE/obs-service-set_version
|
|||||||
Source: https://github.com/openSUSE/obs-service-set_version/archive/%{version}/%{name}-%{version}.tar.gz
|
Source: https://github.com/openSUSE/obs-service-set_version/archive/%{version}/%{name}-%{version}.tar.gz
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
patch0: Handle-removed-packaging.version.LegacyVersion.patch
|
||||||
BuildRequires: python3-ddt python3-flake8 python3-packaging
|
BuildRequires: python3-ddt python3-flake8 python3-packaging
|
||||||
Requires: python3
|
Requires: python3
|
||||||
Recommends: python3-packaging
|
Recommends: python3-packaging
|
||||||
@ -17,10 +18,9 @@ It is a service for building.You can quickly install it
|
|||||||
and update version in spec files.
|
and update version in spec files.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%autosetup -n %{name}-%{version} -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
sed -i -e "1 s,#!/usr/bin/python$,#!%{__python3}," set_version
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
make test PYTHON=%{__python3}
|
make test PYTHON=%{__python3}
|
||||||
@ -36,6 +36,9 @@ install -m 0644 set_version.service %{buildroot}%{_prefix}/lib/obs/service
|
|||||||
%{_prefix}/lib/obs/service
|
%{_prefix}/lib/obs/service
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri May 12 2023 liyanan <thistleslyn@163.com> - 0.5.14-2
|
||||||
|
- Handle removed packaging.version.LegacyVersion
|
||||||
|
|
||||||
* Wed Dec 29 2021 wulei <wulei80@huawei.com> - 0.5.14-1
|
* Wed Dec 29 2021 wulei <wulei80@huawei.com> - 0.5.14-1
|
||||||
- DESC:package update
|
- DESC:package update
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user