Skip to content

Fix issues for python 3.12 #68

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/test_cp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test_new_env_activated () {
mkvirtualenv "source" >/dev/null 2>&1
RC=$?
assertEquals "0" "$RC"
(cd tests/testpackage && python setup.py install) >/dev/null 2>&1
(cd tests/testpackage && pip install .) >/dev/null 2>&1
cpvirtualenv "source" "destination" >/dev/null 2>&1
rmvirtualenv "source" >/dev/null 2>&1
testscript="$(which testscript.py)"
Expand Down
2 changes: 1 addition & 1 deletion tests/test_project_templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ test_dir=$(dirname $0)
source "$test_dir/setup.sh"

oneTimeSetUp() {
(cd "$test_dir/testtemplate" && rm -rf build && "$VIRTUAL_ENV/bin/python" setup.py install)
(cd "$test_dir/testtemplate" && rm -rf build && "$VIRTUAL_ENV/bin/python" -m pip install .)
rm -rf "$WORKON_HOME"
mkdir -p "$WORKON_HOME"
rm -rf "$PROJECT_HOME"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_wipeenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ tearDown() {

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

test_wipeenv_develop () {
mkvirtualenv "wipetest" >/dev/null 2>&1
(cd tests/testpackage && python setup.py develop) >/dev/null 2>&1
(cd tests/testpackage && pip install -e . --config-settings editable_mode=compat) >/dev/null 2>&1
before="$(pip freeze)"
assertTrue "testpackage not installed" "pip freeze | grep testpackage"
wipeenv >/dev/null 2>&1
Expand Down
1 change: 1 addition & 0 deletions tests/testpackage/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setuptools
1 change: 1 addition & 0 deletions tests/testtemplate/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
setuptools
103 changes: 0 additions & 103 deletions tests/testtemplate/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,102 +5,6 @@

from setuptools import setup, find_packages

from distutils.util import convert_path
from fnmatch import fnmatchcase

import os
import sys

##############################################################################
# find_package_data is an Ian Bicking creation.

# Provided as an attribute, so you can append to these instead
# of replicating them:
standard_exclude = ('*.py', '*.pyc', '*~', '.*', '*.bak', '*.swp*')
standard_exclude_directories = ('.*', 'CVS', '_darcs', './build',
'./dist', 'EGG-INFO', '*.egg-info')


def find_package_data(
where='.', package='',
exclude=standard_exclude,
exclude_directories=standard_exclude_directories,
only_in_packages=True,
show_ignored=False):
"""
Return a dictionary suitable for use in ``package_data``
in a distutils ``setup.py`` file.

The dictionary looks like::

{'package': [files]}

Where ``files`` is a list of all the files in that package that
don't match anything in ``exclude``.

If ``only_in_packages`` is true, then top-level directories that
are not packages won't be included (but directories under packages
will).

Directories matching any pattern in ``exclude_directories`` will
be ignored; by default directories with leading ``.``, ``CVS``,
and ``_darcs`` will be ignored.

If ``show_ignored`` is true, then all the files that aren't
included in package data are shown on stderr (for debugging
purposes).

Note patterns use wildcards, or can be exact paths (including
leading ``./``), and all searching is case-insensitive.

This function is by Ian Bicking.
"""

out = {}
stack = [(convert_path(where), '', package, only_in_packages)]
while stack:
where, prefix, package, only_in_packages = stack.pop(0)
for name in os.listdir(where):
fn = os.path.join(where, name)
if os.path.isdir(fn):
bad_name = False
for pattern in exclude_directories:
if (fnmatchcase(name, pattern)
or fn.lower() == pattern.lower()):
bad_name = True
if show_ignored:
print >> sys.stderr, (
"Directory %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
if os.path.isfile(os.path.join(fn, '__init__.py')):
if not package:
new_package = name
else:
new_package = package + '.' + name
stack.append((fn, '', new_package, False))
else:
stack.append((fn, prefix + name + '/', package, only_in_packages))
elif package or not only_in_packages:
# is a file
bad_name = False
for pattern in exclude:
if (fnmatchcase(name, pattern)
or fn.lower() == pattern.lower()):
bad_name = True
if show_ignored:
print >> sys.stderr, (
"File %s ignored by pattern %s"
% (fn, pattern))
break
if bad_name:
continue
out.setdefault(package, []).append(prefix+name)
return out
##############################################################################

setup(
name=PROJECT,
version=VERSION,
Expand Down Expand Up @@ -130,13 +34,6 @@ def find_package_data(

packages=find_packages(),
include_package_data=True,
# Scan the input for package information
# to grab any data files (text, images, etc.)
# associated with sub-packages.
package_data=find_package_data('mytemplates',
package='mytemplates',
only_in_packages=False,
),

entry_points={
'virtualenvwrapper.project.template': [
Expand Down
2 changes: 1 addition & 1 deletion virtualenvwrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ function virtualenvwrapper_get_python_version {

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

# Path management for packages outside of the virtual env.
Expand Down