Skip to content

Commit 23a8c65

Browse files
authored
Merge pull request #68 from parona-source/python3.12
Fix issues for python 3.12
2 parents e20fddc + da927a0 commit 23a8c65

File tree

7 files changed

+7
-108
lines changed

7 files changed

+7
-108
lines changed

tests/test_cp.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ test_new_env_activated () {
2323
mkvirtualenv "source" >/dev/null 2>&1
2424
RC=$?
2525
assertEquals "0" "$RC"
26-
(cd tests/testpackage && python setup.py install) >/dev/null 2>&1
26+
(cd tests/testpackage && pip install .) >/dev/null 2>&1
2727
cpvirtualenv "source" "destination" >/dev/null 2>&1
2828
rmvirtualenv "source" >/dev/null 2>&1
2929
testscript="$(which testscript.py)"

tests/test_project_templates.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ test_dir=$(dirname $0)
44
source "$test_dir/setup.sh"
55

66
oneTimeSetUp() {
7-
(cd "$test_dir/testtemplate" && rm -rf build && "$VIRTUAL_ENV/bin/python" setup.py install)
7+
(cd "$test_dir/testtemplate" && rm -rf build && "$VIRTUAL_ENV/bin/python" -m pip install .)
88
rm -rf "$WORKON_HOME"
99
mkdir -p "$WORKON_HOME"
1010
rm -rf "$PROJECT_HOME"

tests/test_wipeenv.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ tearDown() {
2020

2121
test_wipeenv () {
2222
mkvirtualenv "wipetest" >/dev/null 2>&1
23-
(cd tests/testpackage && python setup.py install) >/dev/null 2>&1
23+
(cd tests/testpackage && pip install .) >/dev/null 2>&1
2424
before="$(pip freeze)"
2525
assertTrue "testpackage not installed" "pip freeze | grep testpackage"
2626
wipeenv >/dev/null 2>&1
@@ -52,7 +52,7 @@ test_wipeenv_pip_e () {
5252

5353
test_wipeenv_develop () {
5454
mkvirtualenv "wipetest" >/dev/null 2>&1
55-
(cd tests/testpackage && python setup.py develop) >/dev/null 2>&1
55+
(cd tests/testpackage && pip install -e . --config-settings editable_mode=compat) >/dev/null 2>&1
5656
before="$(pip freeze)"
5757
assertTrue "testpackage not installed" "pip freeze | grep testpackage"
5858
wipeenv >/dev/null 2>&1

tests/testpackage/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
setuptools

tests/testtemplate/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
setuptools

tests/testtemplate/setup.py

Lines changed: 0 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -5,102 +5,6 @@
55

66
from setuptools import setup, find_packages
77

8-
from distutils.util import convert_path
9-
from fnmatch import fnmatchcase
10-
11-
import os
12-
import sys
13-
14-
##############################################################################
15-
# find_package_data is an Ian Bicking creation.
16-
17-
# Provided as an attribute, so you can append to these instead
18-
# of replicating them:
19-
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
20-
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
21-
'./dist', 'EGG-INFO', '*.egg-info')
22-
23-
24-
def find_package_data(
25-
where='.', package='',
26-
exclude=standard_exclude,
27-
exclude_directories=standard_exclude_directories,
28-
only_in_packages=True,
29-
show_ignored=False):
30-
"""
31-
Return a dictionary suitable for use in ``package_data``
32-
in a distutils ``setup.py`` file.
33-
34-
The dictionary looks like::
35-
36-
{'package': [files]}
37-
38-
Where ``files`` is a list of all the files in that package that
39-
don't match anything in ``exclude``.
40-
41-
If ``only_in_packages`` is true, then top-level directories that
42-
are not packages won't be included (but directories under packages
43-
will).
44-
45-
Directories matching any pattern in ``exclude_directories`` will
46-
be ignored; by default directories with leading ``.``, ``CVS``,
47-
and ``_darcs`` will be ignored.
48-
49-
If ``show_ignored`` is true, then all the files that aren't
50-
included in package data are shown on stderr (for debugging
51-
purposes).
52-
53-
Note patterns use wildcards, or can be exact paths (including
54-
leading ``./``), and all searching is case-insensitive.
55-
56-
This function is by Ian Bicking.
57-
"""
58-
59-
out = {}
60-
stack = [(convert_path(where), '', package, only_in_packages)]
61-
while stack:
62-
where, prefix, package, only_in_packages = stack.pop(0)
63-
for name in os.listdir(where):
64-
fn = os.path.join(where, name)
65-
if os.path.isdir(fn):
66-
bad_name = False
67-
for pattern in exclude_directories:
68-
if (fnmatchcase(name, pattern)
69-
or fn.lower() == pattern.lower()):
70-
bad_name = True
71-
if show_ignored:
72-
print >> sys.stderr, (
73-
"Directory %s ignored by pattern %s"
74-
% (fn, pattern))
75-
break
76-
if bad_name:
77-
continue
78-
if os.path.isfile(os.path.join(fn, '__init__.py')):
79-
if not package:
80-
new_package = name
81-
else:
82-
new_package = package + '.' + name
83-
stack.append((fn, '', new_package, False))
84-
else:
85-
stack.append((fn, prefix + name + '/', package, only_in_packages))
86-
elif package or not only_in_packages:
87-
# is a file
88-
bad_name = False
89-
for pattern in exclude:
90-
if (fnmatchcase(name, pattern)
91-
or fn.lower() == pattern.lower()):
92-
bad_name = True
93-
if show_ignored:
94-
print >> sys.stderr, (
95-
"File %s ignored by pattern %s"
96-
% (fn, pattern))
97-
break
98-
if bad_name:
99-
continue
100-
out.setdefault(package, []).append(prefix+name)
101-
return out
102-
##############################################################################
103-
1048
setup(
1059
name=PROJECT,
10610
version=VERSION,
@@ -130,13 +34,6 @@ def find_package_data(
13034

13135
packages=find_packages(),
13236
include_package_data=True,
133-
# Scan the input for package information
134-
# to grab any data files (text, images, etc.)
135-
# associated with sub-packages.
136-
package_data=find_package_data('mytemplates',
137-
package='mytemplates',
138-
only_in_packages=False,
139-
),
14037

14138
entry_points={
14239
'virtualenvwrapper.project.template': [

virtualenvwrapper.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ function virtualenvwrapper_get_python_version {
820820

821821
# Prints the path to the site-packages directory for the current environment.
822822
function virtualenvwrapper_get_site_packages_dir {
823-
"$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/python" -c "import distutils.sysconfig; print(distutils.sysconfig.get_python_lib())"
823+
"$VIRTUAL_ENV/$VIRTUALENVWRAPPER_ENV_BIN_DIR/python" -c "import sysconfig; print(sysconfig.get_path('platlib'))"
824824
}
825825

826826
# Path management for packages outside of the virtual env.

0 commit comments

Comments
 (0)