init package

This commit is contained in:
caodongxia 2022-04-27 11:04:27 +08:00
parent e23402eea9
commit 39ee1b98aa
3 changed files with 78 additions and 0 deletions

29
fix-pkg-version.patch Normal file
View File

@ -0,0 +1,29 @@
From 0d919288340cad7681c293c2f00111930a917bad Mon Sep 17 00:00:00 2001
From: caodongxia <315816521@qq.com>
Date: Tue, 26 Apr 2022 14:54:41 +0800
Subject: [PATCH] fix pkg version
---
setup.py | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/setup.py b/setup.py
index 6068493..73e204e 100644
--- a/setup.py
+++ b/setup.py
@@ -1,3 +1,11 @@
+import io
+import re
+
from setuptools import setup
+with io.open("src/platformdirs/version.py", "rt", encoding="utf8") as f:
+ version = re.search(r'''__version__ = ['"]([0-9.]+)['"]''', f.read()).group(1)
-setup()
+setup(
+ name="platformdirs",
+ version=version,
+ )
--
2.27.0

BIN
platformdirs-2.3.0.tar.gz Normal file

Binary file not shown.

49
python-platformdirs.spec Normal file
View File

@ -0,0 +1,49 @@
%global srcname platformdirs
%global common_description %{expand:
A small Python module for determining appropriate platform-specific dirs, e.g.
a "user data dir".}
Name: python-%{srcname}
Version: 2.3.0
Release: 1
Summary: Python module for determining appropriate platform-specific dirs
License: MIT
URL: https://github.com/platformdirs/platformdirs
Source0: https://files.pythonhosted.org/packages/e2/d4/c6ffe89de09851892b1418dc22f6ab019b7b6f362532ab813c262e1722bb/platformdirs-2.3.0.tar.gz
Patch0: fix-pkg-version.patch
BuildArch: noarch
BuildRequires: python3-pytest python3-pytest-mock python3-coverage python3-appdirs python3-pip
%description %{common_description}
%package -n python3-%{srcname}
Summary: %{summary}
BuildRequires: python3-devel
%{?python_provide:%python_provide python3-platformdirs}
%description -n python3-%{srcname} %{common_description}
%prep
%autosetup -n %{srcname}-%{version} -p1
cp -r src/platformdirs tests/
cp -r src/platformdirs ./
%build
%py3_build
%install
%py3_install
%check
/usr/bin/pytest
%files -n python3-%{srcname}
%license LICENSE.txt
%doc README.rst CHANGES.rst
%{python3_sitelib}/platformdirs-*.egg-info/
%{python3_sitelib}/platformdirs
%changelog
* Wed Apr 27 2022 caodongxia <caodongxia@h-partners.com> - 2.3.0-1
- init package