Compare commits
11 Commits
cbe9b35e22
...
140660a70a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
140660a70a | ||
|
|
f9ec5b967a | ||
|
|
1fcc698932 | ||
|
|
cbe01e38de | ||
|
|
af0b914623 | ||
|
|
e48b7304ec | ||
|
|
a5b46f58dc | ||
|
|
193542b09c | ||
|
|
f5b7c9f2c3 | ||
|
|
1b7e4599de | ||
|
|
c257811e00 |
134
0001-Remove-usage-of-deprecated-imp-module-with-importlib.patch
Normal file
134
0001-Remove-usage-of-deprecated-imp-module-with-importlib.patch
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
From f11e35645e68888284e0a05e43baf6c4b56ceb4b Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Dan=20=C4=8Cerm=C3=A1k?= <dcermak@suse.com>
|
||||||
|
Date: Fri, 1 Sep 2023 11:56:09 +0200
|
||||||
|
Subject: [PATCH] Remove usage of deprecated imp module with importlib
|
||||||
|
|
||||||
|
---
|
||||||
|
tests/loader.py | 16 ++++++++++++++++
|
||||||
|
tests/test_base.py | 7 +++----
|
||||||
|
tests/test_package_type_detection.py | 6 ++----
|
||||||
|
tests/test_python_pip2rpm.py | 5 ++---
|
||||||
|
tests/test_rpmspec.py | 4 ++--
|
||||||
|
5 files changed, 25 insertions(+), 13 deletions(-)
|
||||||
|
create mode 100644 tests/loader.py
|
||||||
|
|
||||||
|
diff --git a/tests/loader.py b/tests/loader.py
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..1087b26
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/tests/loader.py
|
||||||
|
@@ -0,0 +1,16 @@
|
||||||
|
+import importlib.machinery
|
||||||
|
+import importlib.util
|
||||||
|
+from pathlib import Path
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def import_set_version():
|
||||||
|
+ """Imports the set_version script as a python module and returns it."""
|
||||||
|
+ loader = importlib.machinery.SourceFileLoader(
|
||||||
|
+ 'set_version',
|
||||||
|
+ str(Path(__file__).parent.joinpath("..", "set_version"))
|
||||||
|
+ )
|
||||||
|
+ spec = importlib.util.spec_from_loader('set_version', loader)
|
||||||
|
+ sv = importlib.util.module_from_spec(spec)
|
||||||
|
+ loader.exec_module(sv)
|
||||||
|
+
|
||||||
|
+ return sv
|
||||||
|
diff --git a/tests/test_base.py b/tests/test_base.py
|
||||||
|
index c894bd4..0ebc1bd 100644
|
||||||
|
--- a/tests/test_base.py
|
||||||
|
+++ b/tests/test_base.py
|
||||||
|
@@ -15,7 +15,6 @@
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA.
|
||||||
|
|
||||||
|
|
||||||
|
-import imp
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
@@ -25,15 +24,15 @@
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
-
|
||||||
|
from ddt import data, ddt, unpack
|
||||||
|
|
||||||
|
+from loader import import_set_version
|
||||||
|
+
|
||||||
|
DEBUG = False
|
||||||
|
if os.environ.get('DEBUG_SET_VERSION') == "1":
|
||||||
|
DEBUG = True
|
||||||
|
|
||||||
|
-# NOTE(toabctl): Hack to import non-module file for testing
|
||||||
|
-sv = imp.load_source("set_version", "set_version")
|
||||||
|
+sv = import_set_version()
|
||||||
|
|
||||||
|
|
||||||
|
SET_VERSION_EXECUTABLE = os.path.abspath(
|
||||||
|
diff --git a/tests/test_package_type_detection.py b/tests/test_package_type_detection.py
|
||||||
|
index 231792c..82b768b 100644
|
||||||
|
--- a/tests/test_package_type_detection.py
|
||||||
|
+++ b/tests/test_package_type_detection.py
|
||||||
|
@@ -15,15 +15,13 @@
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA.
|
||||||
|
|
||||||
|
|
||||||
|
-import imp
|
||||||
|
-
|
||||||
|
from ddt import data, ddt, unpack
|
||||||
|
|
||||||
|
from test_base import SetVersionBaseTest
|
||||||
|
+from tests.loader import import_set_version
|
||||||
|
|
||||||
|
|
||||||
|
-# NOTE(toabctl): Hack to import non-module file for testing
|
||||||
|
-sv = imp.load_source("set_version", "set_version")
|
||||||
|
+sv = import_set_version()
|
||||||
|
|
||||||
|
|
||||||
|
@ddt
|
||||||
|
diff --git a/tests/test_python_pip2rpm.py b/tests/test_python_pip2rpm.py
|
||||||
|
index 270028a..db53ce8 100644
|
||||||
|
--- a/tests/test_python_pip2rpm.py
|
||||||
|
+++ b/tests/test_python_pip2rpm.py
|
||||||
|
@@ -15,7 +15,6 @@
|
||||||
|
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA.
|
||||||
|
|
||||||
|
|
||||||
|
-import imp
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import unittest
|
||||||
|
@@ -25,10 +24,10 @@
|
||||||
|
from packaging.version import parse
|
||||||
|
|
||||||
|
from test_base import SetVersionBaseTest
|
||||||
|
+from tests.loader import import_set_version
|
||||||
|
|
||||||
|
|
||||||
|
-# NOTE(toabctl): Hack to import non-module file for testing
|
||||||
|
-sv = imp.load_source("set_version", "set_version")
|
||||||
|
+sv = import_set_version()
|
||||||
|
|
||||||
|
|
||||||
|
def _has_zypper():
|
||||||
|
diff --git a/tests/test_rpmspec.py b/tests/test_rpmspec.py
|
||||||
|
index 6c76307..7f1e3a1 100644
|
||||||
|
--- a/tests/test_rpmspec.py
|
||||||
|
+++ b/tests/test_rpmspec.py
|
||||||
|
@@ -16,13 +16,13 @@
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
-import imp
|
||||||
|
import shutil
|
||||||
|
from ddt import data, ddt, file_data, unpack
|
||||||
|
|
||||||
|
from test_base import SetVersionBaseTest
|
||||||
|
+from tests.loader import import_set_version
|
||||||
|
|
||||||
|
-sv = imp.load_source("set_version", "set_version")
|
||||||
|
+sv = import_set_version()
|
||||||
|
|
||||||
|
|
||||||
|
@ddt
|
||||||
Binary file not shown.
BIN
obs-service-set_version-0.6.2.tar.gz
Normal file
BIN
obs-service-set_version-0.6.2.tar.gz
Normal file
Binary file not shown.
@ -1,37 +1,53 @@
|
|||||||
Name: obs-service-set_version
|
Name: obs-service-set_version
|
||||||
Version: 0.5.10
|
Version: 0.6.2
|
||||||
Release: 4
|
Release: 1
|
||||||
Summary: Set the version in spec
|
Summary: Set the version in spec
|
||||||
License: GPLv2+
|
License: GPL-2.0-or-later
|
||||||
|
Group: Development/Tools/Building
|
||||||
URL: https://github.com/openSUSE/obs-service-set_version
|
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
|
||||||
BuildRequires: sed python3dist(packaging) python3-devel
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
Requires: python3
|
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
# imp has been deprecated since python 3.3 and has been removed in python 3.12
|
||||||
|
Patch0: https://github.com/openSUSE/obs-service-set_version/pull/86.patch#./0001-Remove-usage-of-deprecated-imp-module-with-importlib.patch
|
||||||
|
BuildRequires: python3-ddt python3-packaging
|
||||||
|
Requires: python3
|
||||||
|
Recommends: python3-packaging
|
||||||
|
|
||||||
%description
|
%description
|
||||||
It is a service for building.You can quickly install it
|
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
|
||||||
%autosetup
|
%autosetup -n %{name}-%{version} -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
sed -i -e "1 s,#!/usr/bin/python$,#!%{__python3}," set_version
|
|
||||||
|
|
||||||
%install
|
|
||||||
mkdir -p %{buildroot}%{_prefix}/lib/obs/service
|
|
||||||
install -m 0644 set_version.service %{buildroot}%{_prefix}/lib/obs/service
|
|
||||||
install -m 0755 set_version %{buildroot}%{_prefix}/lib/obs/service
|
|
||||||
|
|
||||||
%check
|
%check
|
||||||
%{__python3} -m unittest discover tests/
|
%{__python3} -m unittest discover tests/
|
||||||
|
|
||||||
|
%install
|
||||||
|
mkdir -p %{buildroot}%{_prefix}/lib/obs/service
|
||||||
|
install -m 0755 set_version %{buildroot}%{_prefix}/lib/obs/service
|
||||||
|
install -m 0644 set_version.service %{buildroot}%{_prefix}/lib/obs/service
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%license debian/copyright
|
%defattr(-,root,root)
|
||||||
%dir %{_prefix}/lib/obs
|
%dir %{_prefix}/lib/obs
|
||||||
%{_prefix}/lib/obs/service
|
%{_prefix}/lib/obs/service
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Oct 18 2023 wangkai <13474090681@163.com> - 0.6.2-1
|
||||||
|
- Update to 0.6.2
|
||||||
|
|
||||||
|
* 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
|
||||||
|
- DESC:package update
|
||||||
|
|
||||||
|
* Sat Mar 21 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.5.10-5
|
||||||
|
- DESC:modify the spec file,do not need python3-devel and python3dist(packaging) for building
|
||||||
|
|
||||||
* Thu Mar 5 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.5.10-4
|
* Thu Mar 5 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.5.10-4
|
||||||
- DESC:init package
|
- DESC:init package
|
||||||
|
|||||||
4
obs-service-set_version.yaml
Normal file
4
obs-service-set_version.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
version_control: github
|
||||||
|
src_repo: openSUSE/obs-service-set_version
|
||||||
|
tag_prefix: ""
|
||||||
|
seperator: "."
|
||||||
Loading…
x
Reference in New Issue
Block a user