!1 Init Packaging, Add source files.

From: @dwl301 
Reviewed-by: @zhang__3125 
Signed-off-by: @zhang__3125
This commit is contained in:
openeuler-ci-bot 2022-07-20 09:19:34 +00:00 committed by Gitee
commit 32ded1889e
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
6 changed files with 128 additions and 0 deletions

Binary file not shown.

22
export-git-snapshot.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
PROJECT=css-parsing-tests
REPO=git@github.com:SimonSapin/css-parsing-tests.git
githash=$1
if [ -z "$githash" ]; then
echo "usage: $0 GITHASH"
exit 1
fi
shorthash=${githash:0:8}
outputfile="${PROJECT}"-$shorthash.tar.gz
rm -rf "${PROJECT}"-temp
git clone "${REPO}" "${PROJECT}"-temp
cd "${PROJECT}"-temp
git archive --prefix="${PROJECT}"-$shorthash/ --format=tar ${githash} \
| gzip --stdout > ../$outputfile
cd ..
rm -rf "${PROJECT}"-temp
echo "exported source code in $outputfile"

View File

@ -0,0 +1,35 @@
diff --git a/pyproject.toml b/pyproject.toml
index 41535ed..30dbcd4 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -32,7 +32,7 @@ classifiers = [
[tool.flit.metadata.requires-extra]
doc = ['sphinx', 'sphinx_rtd_theme']
-test = ['pytest', 'pytest-cov', 'pytest-flake8', 'pytest-isort', 'coverage[toml]']
+test = ['pytest', 'pytest-cov', 'coverage[toml]']
[tool.flit.metadata.urls]
Documentation = 'https://tinycss2.readthedocs.io/'
@@ -44,7 +44,7 @@ Donation = 'https://opencollective.com/courtbouillon'
exclude = ['.*']
[tool.pytest.ini_options]
-addopts = '--isort --flake8 --cov'
+addopts = '--cov'
norecursedirs = ['tests/css-parsing-tests']
[tool.coverage.run]
diff --git a/setup.py b/setup.py
index 8e8a09c..8901670 100644
--- a/setup.py
+++ b/setup.py
@@ -16,8 +16,6 @@ extras_require = \
{'doc': ['sphinx', 'sphinx_rtd_theme'],
'test': ['pytest',
'pytest-cov',
- 'pytest-flake8',
- 'pytest-isort',
'coverage[toml]']}
setup(name='tinycss2',

67
python-tinycss2.spec Normal file
View File

@ -0,0 +1,67 @@
%global srcname tinycss2
%global py3_prefix python%{python3_pkgversion}
Name: python-%{srcname}
Version: 1.1.0
Release: 1
Summary: Low-level CSS parser for Python
License: BSD
URL: https://pypi.python.org/pypi/%{srcname}/
Source0: %pypi_source
Source1: export-git-snapshot.sh
Source2: css-parsing-tests-c5749e5.tar.gz
Patch0: %{name}-disable-flake8-isort-for-pytest.patch
BuildArch: noarch
BuildRequires: gzip
BuildRequires: tar
BuildRequires: %{py3_prefix}-devel
BuildRequires: %{py3_prefix}-pytest
BuildRequires: %{py3_prefix}-pytest-cov
BuildRequires: %{py3_prefix}-pytest-runner
BuildRequires: %{py3_prefix}-setuptools
BuildRequires: %{py3_prefix}-webencodings >= 0.4
BuildRequires: %{py3_prefix}-tomli
%description
tinycss2 is a modern, low-level CSS parser for Python. tinycss2 is a rewrite of
tinycss with a simpler API, based on the more recent CSS Syntax Level 3
specification.
%package -n %{py3_prefix}-%{srcname}
Summary: Low-level CSS parser for Python 3
Requires: %{py3_prefix}-webencodings >= 0.4
%{?python_provide:%python_provide %{py3_prefix}-%{srcname}}
%description -n %{py3_prefix}-%{srcname}
tinycss2 is a modern, low-level CSS parser for Python. tinycss2 is a rewrite of
tinycss with a simpler API, based on the more recent CSS Syntax Level 3
specification.
%prep
%autosetup -n %{srcname}-%{version}
tar xf "%{SOURCE2}"
cp -a css-parsing-tests-???????/* tests/css-parsing-tests/
%build
%py3_build
%install
%py3_install
%check
%{__python3} -m pytest -v
# remove files which are only required for unit tests (including test.pyc/.pyo)
rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/css-parsing-tests
rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/test.py
rm -rf %{buildroot}%{python3_sitelib}/%{srcname}/__pycache__/test.*.py?
%files -n %{py3_prefix}-%{srcname}
%license LICENSE
%doc README.rst
%{python3_sitelib}/%{srcname}/
%{python3_sitelib}/%{srcname}-%{version}-py%{python3_version}.egg-info
%changelog
* Mon Jun 27 2022 lin zhang <lin.zhang@turbolinux.com.cn> - 1.1.0-1
- initial package

4
python-tinycss2.yaml Normal file
View File

@ -0,0 +1,4 @@
version_control: pypi
src_repo: tinycss2
tag_prefix: ^
seperator: .

BIN
tinycss2-1.1.0.tar.gz Normal file

Binary file not shown.