Package init

This commit is contained in:
overweight 2019-09-30 11:15:33 -04:00
commit 0e5f5ae922
4 changed files with 186 additions and 0 deletions

View File

@ -0,0 +1,18 @@
From 6187ec30bc26111c9e197c92385bd1e6b0faf7ae Mon Sep 17 00:00:00 2001
From: chenzhen <chenzhen44@huawei.com>
Date: Thu, 11 Apr 2019 21:55:54 +0800
Subject: [PATCH] python-setuptools: eliminate differences
reason:eliminate differences of source code
--- setuptools-40.4.3_old/setuptools/dist.py 2019-04-11 21:46:27.616000000 +0800
+++ setuptools-40.4.3/setuptools/dist.py 2019-04-11 21:46:55.428000000 +0800
@@ -119,7 +119,7 @@
self.long_description_content_type
)
if self.provides_extras:
- for extra in self.provides_extras:
+ for extra in sorted(self.provides_extras):
file.write('Provides-Extra: %s\n' % extra)

View File

@ -0,0 +1,17 @@
diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py
index 91c48b3..0c9b0f4 100755
--- a/setuptools/command/easy_install.py
+++ b/setuptools/command/easy_install.py
@@ -446,6 +446,12 @@ class easy_install(Command):
instdir = normalize_path(self.install_dir)
pth_file = os.path.join(instdir, 'easy-install.pth')
+ if not os.path.exists(instdir):
+ try:
+ os.makedirs(instdir)
+ except (OSError, IOError):
+ self.cant_write_to_target()
+
# Is it a configured, PYTHONPATH, implicit, or explicit site dir?
is_site_dir = instdir in self.all_site_dirs

151
python-setuptools.spec Normal file
View File

@ -0,0 +1,151 @@
%bcond_without tests
%bcond_without python2
%if %{with python2}
%global python2_record %{python2_sitelib}/setuptools-%{version}.dist-info/RECORD
%endif
%global python3_record %{python3_sitelib}/setuptools-%{version}.dist-info/RECORD
%global python_whldir %{_datadir}/python-wheels
%global python_whlname setuptools-%{version}-py2.py3-none-any.whl
Name: python-setuptools
Version: 40.4.3
Release: 3
Summary: Easily build and distribute Python packages
License: MIT and (BSD or ASL 2.0)
URL: https://pypi.python.org/pypi/setuptools
Source0: %{pypi_source setuptools %{version} zip}
Patch0: create-site-packages.patch
Patch9000: bugfix-eliminate-random-order-in-metadata.patch
BuildArch: noarch
%if %{with python2}
BuildRequires: python2-devel
BuildRequires: python2-pip, python2-wheel
%if %{with tests}
BuildRequires: python2-pip, python2-mock, python2-backports-unittest_mock
BuildRequires: python2-pytest, python2-pytest-fixture-config
BuildRequires: python2-pytest-virtualenv
%endif
%endif
BuildRequires: python3-devel
%if %{with tests}
BuildRequires: python3-pip, python3-mock
BuildRequires: python3-pytest, python3-pytest-fixture-config
BuildRequires: python3-pytest-virtualenv
%endif
BuildRequires: python3-pip, python3-wheel
Provides: python-distribute = %{version}-%{release}, %{name}-wheel
Obsoletes: python-distribute < 0.6.36-2, %{name}-wheel
%description
Setuptools is a collection of enhancements to the Python distutils that allow
you to more easily build and distribute Python packages, especially ones that
have dependencies on other packages.
This package contains a python wheel of setuptools to use with venv.
%if %{with python2}
%package -n python2-setuptools
Summary: Easily build and distribute Python packages
%{?python_provide:%python_provide python2-setuptools}
%description -n python2-setuptools
Setuptools is a collection of enhancements to the Python 2 distutils that allow
you to more easily build and distribute Python 2 packages, especially ones that
have dependencies on other packages.
This package also contains the runtime components of setuptools, necessary to
execute the software that requires pkg_resources.py.
%endif
%package -n python3-setuptools
Summary: Easily build and distribute Python 3 packages
Conflicts: python-setuptools < %{version}-%{release}
%description -n python3-setuptools
Setuptools is a collection of enhancements to the Python 3 distutils that allow
you to more easily build and distribute Python 3 packages, especially ones that
have dependencies on other packages.
This package also contains the runtime components of setuptools, necessary to
execute the software that requires pkg_resources.py.
%package_help
%prep
%autosetup -n setuptools-%{version} -p1
find setuptools pkg_resources -name \*.py | xargs sed -i -e '1 {/^#!\//d}'
rm -f setuptools/*.exe
rm setuptools/tests/test_integration.py
chmod -x README.rst
%build
%py3_build_wheel
%install
%py3_install_wheel %{python_whlname}
sed -i '/\/usr\/bin\/easy_install,/d' %{buildroot}%{python3_record}
rm %{buildroot}%{_bindir}/easy_install
rm -rf %{buildroot}%{python3_sitelib}/setuptools/tests
sed -i '/^setuptools\/tests\//d' %{buildroot}%{python3_record}
find %{buildroot}%{python3_sitelib} -name '*.exe' | xargs rm -f
%if %{with python2}
%py2_install_wheel %{python_whlname}
rm -rf %{buildroot}%{python2_sitelib}/setuptools/tests
sed -i '/^setuptools\/tests\//d' %{buildroot}%{python2_record}
find %{buildroot}%{python2_sitelib} -name '*.exe' | xargs rm -f
%endif
rm -r docs/{Makefile,conf.py,_*}
mkdir -p %{buildroot}%{python_whldir}
install -p dist/%{python_whlname} -t %{buildroot}%{python_whldir}
%if %{with tests}
%check
%if %{with python2}
PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(pwd) py.test-%{python2_version}
%endif
PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=$(pwd) py.test-%{python3_version} --ignore=setuptools/tests/test_virtualenv.py --ignore=pavement.py
%endif
%files
%defattr(-,root,root)
%license LICENSE
%dir %{python_whldir}/
%{python_whldir}/%{python_whlname}
%if %{with python2}
%files -n python2-setuptools
%defattr(-,root,root)
%{_bindir}/easy_install
%{_bindir}/easy_install-2.*
%{python2_sitelib}/*
%endif
%files -n python3-setuptools
%defattr(-,root,root)
%{_bindir}/easy_install-3.*
%{python3_sitelib}/easy_install.py
%{python3_sitelib}/pkg_resources/
%{python3_sitelib}/setuptools*/
%{python3_sitelib}/__pycache__/*
%files help
%defattr(-,root,root)
%doc docs/* CHANGES.rst README.rst
%changelog
* Mon Sep 23 2019 openEuler Buildteam <buildteam@openeuler.org> - 40.4.3-3
- Fix python-setuptools-wheel dependency problems
* Wed Sep 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 40.4.3-2
- Package init

BIN
setuptools-40.4.3.zip Normal file

Binary file not shown.