[packages/python-virtualenv] Drop old PLD hacks, main binary in a new package
jajcus
jajcus at pld-linux.org
Tue Dec 1 18:53:56 CET 2015
commit 4beaafdc4438847d67c042bfbfdd6ff480b6225d
Author: Jacek Konieczny <jajcus at jajcus.net>
Date: Tue Dec 1 18:52:10 2015 +0100
Drop old PLD hacks, main binary in a new package
- python and python3 are now updated for compatibility with vanila
virtualenv
- pack /usr/bin/virtualenv (Python 3 by default) in the 'virtualenv'
package
- Release: 3
python-virtualenv.spec | 60 ++++++----
unpack-support.py | 23 ----
virtualenv-pld.patch | 238 ---------------------------------------
virtualenv-rebuild-support.patch | 12 --
4 files changed, 35 insertions(+), 298 deletions(-)
---
diff --git a/python-virtualenv.spec b/python-virtualenv.spec
index 6ac67e0..d0cbf2f 100644
--- a/python-virtualenv.spec
+++ b/python-virtualenv.spec
@@ -1,7 +1,6 @@
#
# Conditional build:
%bcond_without doc # don't build doc
-%bcond_with tests # do perform tests (does not work)
%bcond_without python2 # CPython 2.x module
%bcond_without python3 # CPython 3.x module
@@ -10,23 +9,20 @@ Summary: Tool to create isolated Python environments
Summary(pl.UTF-8): Narzędzie do tworzenia oddzielonych środowisk Pythona
Name: python-virtualenv
Version: 13.1.2
-Release: 2
+Release: 3
License: MIT
Group: Development/Languages
Source0: https://pypi.python.org/packages/source/v/virtualenv/virtualenv-%{version}.tar.gz
# Source0-md5: b989598f068d64b32dead530eb25589a
-Source2: unpack-support.py
-Patch0: virtualenv-pld.patch
-Patch1: virtualenv-rebuild-support.patch
URL: https://pypi.python.org/pypi/virtualenv
%if %{with python2}
BuildRequires: python >= 1:2.6
-BuildRequires: python-modules >= 1:2.6
+BuildRequires: python-modules >= 1:2.7.10-6
BuildRequires: python-setuptools
%endif
%if %{with python3}
BuildRequires: python3
-BuildRequires: python3-modules
+BuildRequires: python3-modules >= 1:3.5.0-6
BuildRequires: python3-setuptools
%endif
BuildRequires: rpm-pythonprov
@@ -71,24 +67,39 @@ Jest to następca workignenv i rozszerzenie virtual-pythona. Jest
tworzone przez Iana Bickinga i sponsorowane przez Open Planning
Project. Zostało wydane na liberalnej licencji w stylu MIT.
-%prep
-%setup -q -n virtualenv-%{version}
-install -p -p %{SOURCE2} bin
-%patch1 -p1
+%package -n virtualenv
+Summary: Tool to create isolated Python environments
+Summary(pl.UTF-8): Narzędzie do tworzenia oddzielonych środowisk Pythona
+Group: Libraries/Python
+%if %{with python3}
+Requires: python3-virtualenv = %{version}-%{release}
+%else
+Requires: python-virtualenv = %{version}-%{release}
+%endif
-%{__python} ./bin/unpack-support.py
+%description -n virtualenv
+virtualenv is a tool to create isolated Python environments.
+virtualenv is a successor to workingenv, and an extension of
+virtual-python. It is written by Ian Bicking, and sponsored by the
+Open Planning Project. It is licensed under an MIT-style permissive
+license.
-%patch0 -p1
+%description -n virtualenv -l pl.UTF-8
+virtualenv to narzędzie do tworzenia oddzielonych środowisk Pythona.
+Jest to następca workignenv i rozszerzenie virtual-pythona. Jest
+tworzone przez Iana Bickinga i sponsorowane przez Open Planning
+Project. Zostało wydane na liberalnej licencji w stylu MIT.
-%{__python} ./bin/rebuild-script.py
+%prep
+%setup -q -n virtualenv-%{version}
%build
%if %{with python2}
-%py_build %{?with_tests:test}
+%py_build
%endif
%if %{with python3}
-%py3_build %{?with_tests:test}
+%py3_build
%endif
%if %{with doc}
@@ -99,14 +110,14 @@ cd docs
%install
rm -rf $RPM_BUILD_ROOT
-%if %{with python3}
-%py3_install
-%endif
-
%if %{with python2}
%py_install
%endif
+%if %{with python3}
+%py3_install
+%endif
+
%clean
rm -rf $RPM_BUILD_ROOT
@@ -114,7 +125,6 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%doc docs/_build/text/*.txt
-%attr(755,root,root) %{_bindir}/virtualenv
%attr(755,root,root) %{_bindir}/virtualenv-2.*
%{py_sitescriptdir}/virtualenv-%{version}-py*.egg-info
%{py_sitescriptdir}/virtualenv.py*
@@ -127,11 +137,7 @@ rm -rf $RPM_BUILD_ROOT
%if %{with python3}
%files -n python3-%{module}
%defattr(644,root,root,755)
-
%doc docs/_build/text/*.txt
-%if %{without python2}
-%attr(755,root,root) %{_bindir}/virtualenv
-%endif
%attr(755,root,root) %{_bindir}/virtualenv-3.*
%{py3_sitescriptdir}/virtualenv-%{version}-py*.egg-info
%{py3_sitescriptdir}/__pycache__/virtualenv*
@@ -141,3 +147,7 @@ rm -rf $RPM_BUILD_ROOT
%{py3_sitescriptdir}/virtualenv_support/*.whl
%{py3_sitescriptdir}/virtualenv_support/__pycache__
%endif
+
+%files -n virtualenv
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/virtualenv
diff --git a/unpack-support.py b/unpack-support.py
deleted file mode 100644
index d357315..0000000
--- a/unpack-support.py
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/usr/bin/python
-
-import re
-import os
-import sys
-
-cmd_folder = os.path.dirname(os.path.abspath(__file__))
-sys.path.insert(0, os.path.join(cmd_folder, '..'))
-
-import virtualenv
-
-file_regex = re.compile(
- r'##file (.*?)\n([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*convert\("""(.*?)"""\)',
- re.S)
-
-f = open('virtualenv.py', 'rb')
-content = f.read()
-f.close()
-match = None
-for match in file_regex.finditer(content):
- f = open(os.path.join('virtualenv_support', match.group(1)), 'wb')
- f.write(eval("virtualenv." + match.group(2)).encode('utf-8'))
- f.close()
diff --git a/virtualenv-pld.patch b/virtualenv-pld.patch
deleted file mode 100644
index 56dc7d7..0000000
--- a/virtualenv-pld.patch
+++ /dev/null
@@ -1,238 +0,0 @@
---- virtualenv-12.0.4/virtualenv.py.orig 2014-12-24 03:58:14.000000000 +0100
-+++ virtualenv-12.0.4/virtualenv.py 2014-12-27 10:26:19.257987307 +0100
-@@ -110,7 +110,71 @@
- 'fnmatch', 'locale', 'encodings', 'codecs',
- 'stat', 'UserDict', 'readline', 'copy_reg', 'types',
- 're', 'sre', 'sre_parse', 'sre_constants', 'sre_compile',
-- 'zlib']
-+ 'zlib',
-+ '_bisect',
-+ '_bsddb',
-+ '_codecs_cn',
-+ '_codecs_hk',
-+ '_codecs_iso2022',
-+ '_codecs_jp',
-+ '_codecs_kr',
-+ '_codecs_tw',
-+ '_collections',
-+ '_csv',
-+ '_ctypes',
-+ '_ctypes_test',
-+ '_curses',
-+ '_curses_panel',
-+ '_elementtree',
-+ '_functools',
-+ '_hashlib',
-+ '_heapq',
-+ '_hotshot',
-+ '_io',
-+ '_json',
-+ '_locale',
-+ '_lsprof',
-+ '_multibytecodec',
-+ '_multiprocessing',
-+ '_random',
-+ '_socket',
-+ '_sqlite3',
-+ '_ssl',
-+ '_struct',
-+ '_testcapi',
-+ '_tkinter',
-+ 'array',
-+ 'audioop',
-+ 'binascii',
-+ 'bz2',
-+ 'cPickle',
-+ 'cStringIO',
-+ 'cmath',
-+ 'crypt',
-+ 'datetime',
-+ 'dbm',
-+ 'fcntl',
-+ 'future_builtins',
-+ 'gdbm',
-+ 'grp',
-+ 'itertools',
-+ 'linuxaudiodev',
-+ 'math',
-+ 'mmap',
-+ 'nis',
-+ 'operator',
-+ 'optparse',
-+ 'ossaudiodev',
-+ 'parser',
-+ 'pyexpat',
-+ 'resource',
-+ 'select',
-+ 'spwd',
-+ 'strop',
-+ 'syslog',
-+ 'termios',
-+ 'time',
-+ 'unicodedata']
-
- REQUIRED_FILES = ['lib-dynload', 'config']
-
-@@ -1035,18 +1099,8 @@
- inc_dir = join(home_dir, 'include')
- bin_dir = join(home_dir, 'bin')
- elif not is_win:
-- lib_dir = join(home_dir, 'lib', py_version)
-- multiarch_exec = '/usr/bin/multiarch-platform'
-- if is_executable_file(multiarch_exec):
-- # In Mageia (2) and Mandriva distros the include dir must be like:
-- # virtualenv/include/multiarch-x86_64-linux/python2.7
-- # instead of being virtualenv/include/python2.7
-- p = subprocess.Popen(multiarch_exec, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-- stdout, stderr = p.communicate()
-- # stdout.strip is needed to remove newline character
-- inc_dir = join(home_dir, 'include', stdout.strip(), py_version + abiflags)
-- else:
-- inc_dir = join(home_dir, 'include', py_version + abiflags)
-+ lib_dir = join(home_dir, sys.lib, py_version)
-+ inc_dir = join(home_dir, 'include', py_version + abiflags)
- bin_dir = join(home_dir, 'bin')
- return home_dir, lib_dir, inc_dir, bin_dir
-
-@@ -1157,7 +1211,6 @@
- else:
- prefix = sys.prefix
- mkdir(lib_dir)
-- fix_lib64(lib_dir, symlink)
- stdlib_dirs = [os.path.dirname(os.__file__)]
- if is_win:
- stdlib_dirs.append(join(os.path.dirname(stdlib_dirs[0]), 'DLLs'))
-@@ -1190,6 +1243,15 @@
- site_filename = site_filename.replace('$py.class', '.py')
- site_filename_dst = change_prefix(site_filename, home_dir)
- site_dir = os.path.dirname(site_filename_dst)
-+ # PLD fix
-+ try:
-+ os.symlink(
-+ make_relative_path(os.path.join(site_dir, 'site-packages'),
-+ os.path.join(lib_dir, 'site-packages')),
-+ os.path.join(site_dir, 'site-packages')
-+ )
-+ except (OSError, NotImplementedError):
-+ logger.info('Symlinking site-packages failed.')
- writefile(site_filename_dst, SITE_PY)
- writefile(join(site_dir, 'orig-prefix.txt'), prefix)
- site_packages_filename = join(site_dir, 'no-global-site-packages.txt')
-@@ -1227,7 +1289,7 @@
- elif is_jython:
- exec_dir = join(sys.exec_prefix, 'Lib')
- else:
-- exec_dir = join(sys.exec_prefix, 'lib', py_version)
-+ exec_dir = join(sys.exec_prefix, sys.lib, py_version)
- for fn in os.listdir(exec_dir):
- copyfile(join(exec_dir, fn), join(lib_dir, fn), symlink)
-
-@@ -1549,37 +1611,6 @@
- copyfile(os.path.abspath(os.path.join(home_dir, subdir_name)), \
- os.path.join(local_path, subdir_name), symlink)
-
--def fix_lib64(lib_dir, symlink=True):
-- """
-- Some platforms (particularly Gentoo on x64) put things in lib64/pythonX.Y
-- instead of lib/pythonX.Y. If this is such a platform we'll just create a
-- symlink so lib64 points to lib
-- """
-- if [p for p in distutils.sysconfig.get_config_vars().values()
-- if isinstance(p, basestring) and 'lib64' in p]:
-- # PyPy's library path scheme is not affected by this.
-- # Return early or we will die on the following assert.
-- if is_pypy:
-- logger.debug('PyPy detected, skipping lib64 symlinking')
-- return
--
-- logger.debug('This system uses lib64; symlinking lib64 to lib')
--
-- assert os.path.basename(lib_dir) == 'python%s' % sys.version[:3], (
-- "Unexpected python lib dir: %r" % lib_dir)
-- lib_parent = os.path.dirname(lib_dir)
-- top_level = os.path.dirname(lib_parent)
-- lib_dir = os.path.join(top_level, 'lib')
-- lib64_link = os.path.join(top_level, 'lib64')
-- assert os.path.basename(lib_parent) == 'lib', (
-- "Unexpected parent dir: %r" % lib_parent)
-- if os.path.lexists(lib64_link):
-- return
-- if symlink:
-- os.symlink('lib', lib64_link)
-- else:
-- copyfile('lib', lib64_link)
--
- def resolve_interpreter(exe):
- """
- If the executable given isn't an absolute path, search $PATH for the interpreter
---- virtualenv-12.0.4/virtualenv_support/site.py.orig 2014-12-27 10:00:19.374719042 +0100
-+++ virtualenv-12.0.4/virtualenv_support/site.py 2014-12-27 10:28:33.224647961 +0100
-@@ -231,37 +231,20 @@
-
- elif os.sep == '/':
- sitedirs = [os.path.join(prefix,
-- "lib",
-+ sys.lib,
- "python" + sys.version[:3],
- "site-packages"),
-- os.path.join(prefix, "lib", "site-python"),
-+ os.path.join(prefix, sys.lib, "site-python"),
- os.path.join(prefix, "python" + sys.version[:3], "lib-dynload")]
-- lib64_dir = os.path.join(prefix, "lib64", "python" + sys.version[:3], "site-packages")
-- if (os.path.exists(lib64_dir) and
-- os.path.realpath(lib64_dir) not in [os.path.realpath(p) for p in sitedirs]):
-- if _is_64bit:
-- sitedirs.insert(0, lib64_dir)
-- else:
-- sitedirs.append(lib64_dir)
- try:
- # sys.getobjects only available in --with-pydebug build
- sys.getobjects
- sitedirs.insert(0, os.path.join(sitedirs[0], 'debug'))
- except AttributeError:
- pass
-- # Debian-specific dist-packages directories:
-- sitedirs.append(os.path.join(prefix, "local/lib",
-- "python" + sys.version[:3],
-- "dist-packages"))
-- if sys.version[0] == '2':
-- sitedirs.append(os.path.join(prefix, "lib",
-- "python" + sys.version[:3],
-- "dist-packages"))
-- else:
-- sitedirs.append(os.path.join(prefix, "lib",
-- "python" + sys.version[0],
-- "dist-packages"))
-- sitedirs.append(os.path.join(prefix, "lib", "dist-python"))
-+ # PLD-specific noarch directory:
-+ sitedirs.append(os.path.join(prefix, "share",
-+ "python" + sys.version[:3]))
- else:
- sitedirs = [prefix, os.path.join(prefix, "lib", "site-packages")]
- if sys.platform == 'darwin':
-@@ -581,14 +564,9 @@
- elif sys.platform == 'win32':
- paths = [os.path.join(sys.real_prefix, 'Lib'), os.path.join(sys.real_prefix, 'DLLs')]
- else:
-- paths = [os.path.join(sys.real_prefix, 'lib', 'python'+sys.version[:3])]
-+ paths = [os.path.join(sys.real_prefix, sys.lib, 'python'+sys.version[:3]),
-+ os.path.join(sys.real_prefix, 'share', 'python'+sys.version[:3])]
- hardcoded_relative_dirs = paths[:] # for the special 'darwin' case below
-- lib64_path = os.path.join(sys.real_prefix, 'lib64', 'python'+sys.version[:3])
-- if os.path.exists(lib64_path):
-- if _is_64bit:
-- paths.insert(0, lib64_path)
-- else:
-- paths.append(lib64_path)
- # This is hardcoded in the Python executable, but relative to
- # sys.prefix. Debian change: we need to add the multiarch triplet
- # here, which is where the real stuff lives. As per PEP 421, in
-@@ -599,7 +577,7 @@
- except AttributeError:
- # This is a non-multiarch aware Python. Fallback to the old way.
- arch = sys.platform
-- plat_path = os.path.join(sys.real_prefix, 'lib',
-+ plat_path = os.path.join(sys.real_prefix, sys.lib,
- 'python'+sys.version[:3],
- 'plat-%s' % arch)
- if os.path.exists(plat_path):
diff --git a/virtualenv-rebuild-support.patch b/virtualenv-rebuild-support.patch
deleted file mode 100644
index 906c99a..0000000
--- a/virtualenv-rebuild-support.patch
+++ /dev/null
@@ -1,12 +0,0 @@
---- virtualenv-1.8.4/bin/rebuild-script.py 2011-08-31 12:30:48.000000000 +0200
-+++ virtualenv-1.9.1/bin/rebuild-script.py 2013-04-05 20:06:30.000000000 +0200
-@@ -29,7 +29,7 @@
- varname = match.group(2)
- data = match.group(3)
- print('Found reference to file %s' % filename)
-- pathname = os.path.join(here, '..', 'virtualenv_embedded', filename)
-+ pathname = os.path.join(here, '..', 'virtualenv_support', filename)
- f = open(pathname, 'rb')
- c = f.read()
- f.close()
-
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/python-virtualenv.git/commitdiff/4beaafdc4438847d67c042bfbfdd6ff480b6225d
More information about the pld-cvs-commit
mailing list