Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
cca86c7f
Commit
cca86c7f
authored
Jun 03, 2018
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Python 3 syntax for new-style clasess
parent
7068f1d4
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
68 additions
and
27 deletions
+68
-27
pkg_resources/__init__.py
pkg_resources/__init__.py
+7
-4
pkg_resources/tests/test_pkg_resources.py
pkg_resources/tests/test_pkg_resources.py
+5
-3
pkg_resources/tests/test_working_set.py
pkg_resources/tests/test_working_set.py
+3
-1
setuptools/__init__.py
setuptools/__init__.py
+3
-1
setuptools/command/develop.py
setuptools/command/develop.py
+3
-1
setuptools/command/easy_install.py
setuptools/command/easy_install.py
+3
-1
setuptools/command/test.py
setuptools/command/test.py
+3
-1
setuptools/config.py
setuptools/config.py
+4
-1
setuptools/package_index.py
setuptools/package_index.py
+4
-2
setuptools/py31compat.py
setuptools/py31compat.py
+4
-1
setuptools/py33compat.py
setuptools/py33compat.py
+2
-1
setuptools/tests/test_build_meta.py
setuptools/tests/test_build_meta.py
+3
-1
setuptools/tests/test_easy_install.py
setuptools/tests/test_easy_install.py
+3
-1
setuptools/tests/test_egg_info.py
setuptools/tests/test_egg_info.py
+4
-2
setuptools/tests/test_glibc.py
setuptools/tests/test_glibc.py
+3
-1
setuptools/tests/test_manifest.py
setuptools/tests/test_manifest.py
+3
-1
setuptools/tests/test_pep425tags.py
setuptools/tests/test_pep425tags.py
+4
-2
setuptools/tests/test_wheel.py
setuptools/tests/test_wheel.py
+3
-1
setuptools/wheel.py
setuptools/wheel.py
+4
-1
No files found.
pkg_resources/__init__.py
View file @
cca86c7f
...
...
@@ -78,6 +78,9 @@ __import__('pkg_resources.extern.packaging.requirements')
__import__
(
'pkg_resources.extern.packaging.markers'
)
__metaclass__
=
type
if
(
3
,
0
)
<
sys
.
version_info
<
(
3
,
4
):
raise
RuntimeError
(
"Python 3.4 or later is required"
)
...
...
@@ -537,7 +540,7 @@ class IResourceProvider(IMetadataProvider):
"""List of resource names in the directory (like ``os.listdir()``)"""
class WorkingSet
(object)
:
class WorkingSet:
"""A collection of active distributions on sys.path (or a similar list)"""
def __init__(self, entries=None):
...
...
@@ -944,7 +947,7 @@ class _ReqExtras(dict):
return not req.marker or any(extra_evals)
class Environment
(object)
:
class Environment:
"""Searchable snapshot of distributions on a search path"""
def __init__(
...
...
@@ -2279,7 +2282,7 @@ EGG_NAME = re.compile(
).match
class EntryPoint
(object)
:
class EntryPoint:
"""Object representing an advertised importable object"""
def __init__(self, name, module_name, attrs=(), extras=(), dist=None):
...
...
@@ -2433,7 +2436,7 @@ def _version_from_file(lines):
return safe_version(value.strip()) or None
class Distribution
(object)
:
class Distribution:
"""Wrap an actual or potential sys.path entry w/metadata"""
PKG_INFO = '
PKG
-
INFO
'
...
...
pkg_resources/tests/test_pkg_resources.py
View file @
cca86c7f
...
...
@@ -23,6 +23,8 @@ try:
except
NameError
:
unicode
=
str
__metaclass__
=
type
def
timestamp
(
dt
):
"""
...
...
@@ -43,7 +45,7 @@ class EggRemover(unicode):
os
.
remove
(
self
)
class
TestZipProvider
(
object
)
:
class
TestZipProvider
:
finalizers
=
[]
ref_time
=
datetime
.
datetime
(
2013
,
5
,
12
,
13
,
25
,
0
)
...
...
@@ -132,7 +134,7 @@ class TestZipProvider(object):
manager
.
cleanup_resources
()
class
TestResourceManager
(
object
)
:
class
TestResourceManager
:
def
test_get_cache_path
(
self
):
mgr
=
pkg_resources
.
ResourceManager
()
path
=
mgr
.
get_cache_path
(
'foo'
)
...
...
@@ -163,7 +165,7 @@ class TestIndependence:
subprocess
.
check_call
(
cmd
)
class
TestDeepVersionLookupDistutils
(
object
)
:
class
TestDeepVersionLookupDistutils
:
@
pytest
.
fixture
def
env
(
self
,
tmpdir
):
"""
...
...
pkg_resources/tests/test_working_set.py
View file @
cca86c7f
...
...
@@ -9,6 +9,8 @@ import pkg_resources
from
.test_resources
import
Metadata
__metaclass__
=
type
def
strip_comments
(
s
):
return
'
\
n
'
.
join
(
...
...
@@ -54,7 +56,7 @@ def parse_distributions(s):
yield dist
class FakeInstaller
(object)
:
class FakeInstaller:
def __init__(self, installable_dists):
self._installable_dists = installable_dists
...
...
setuptools/__init__.py
View file @
cca86c7f
...
...
@@ -15,6 +15,8 @@ from setuptools.dist import Distribution, Feature
from
setuptools.depends
import
Require
from
.
import
monkey
__metaclass__
=
type
__all__
=
[
'setup'
,
'Distribution'
,
'Feature'
,
'Command'
,
'Extension'
,
'Require'
,
'find_packages'
,
...
...
@@ -31,7 +33,7 @@ run_2to3_on_doctests = True
lib2to3_fixer_packages
=
[
'lib2to3.fixes'
]
class
PackageFinder
(
object
)
:
class
PackageFinder
:
"""
Generate a list of all Python packages found within a directory
"""
...
...
setuptools/command/develop.py
View file @
cca86c7f
...
...
@@ -12,6 +12,8 @@ from setuptools.command.easy_install import easy_install
from
setuptools
import
namespaces
import
setuptools
__metaclass__
=
type
class
develop
(
namespaces
.
DevelopInstaller
,
easy_install
):
"""Set up package for development"""
...
...
@@ -192,7 +194,7 @@ class develop(namespaces.DevelopInstaller, easy_install):
return
easy_install
.
install_wrapper_scripts
(
self
,
dist
)
class
VersionlessRequirement
(
object
)
:
class
VersionlessRequirement
:
"""
Adapt a pkg_resources.Distribution to simply return the project
name as the 'requirement' so that scripts will work across
...
...
setuptools/command/easy_install.py
View file @
cca86c7f
...
...
@@ -63,6 +63,8 @@ from pkg_resources import (
)
import
pkg_resources.py31compat
__metaclass__
=
type
# Turn on PEP440Warnings
warnings
.
filterwarnings
(
"default"
,
category
=
pkg_resources
.
PEP440Warning
)
...
...
@@ -2050,7 +2052,7 @@ class WindowsCommandSpec(CommandSpec):
split_args
=
dict
(
posix
=
False
)
class
ScriptWriter
(
object
)
:
class
ScriptWriter
:
"""
Encapsulates behavior around writing entry point scripts for console and
gui apps.
...
...
setuptools/command/test.py
View file @
cca86c7f
...
...
@@ -16,6 +16,8 @@ from pkg_resources import (resource_listdir, resource_exists, normalize_path,
add_activation_listener
,
require
,
EntryPoint
)
from
setuptools
import
Command
__metaclass__
=
type
class
ScanningLoader
(
TestLoader
):
...
...
@@ -58,7 +60,7 @@ class ScanningLoader(TestLoader):
# adapted from jaraco.classes.properties:NonDataProperty
class
NonDataProperty
(
object
)
:
class
NonDataProperty
:
def
__init__
(
self
,
fget
):
self
.
fget
=
fget
...
...
setuptools/config.py
View file @
cca86c7f
...
...
@@ -11,6 +11,9 @@ from setuptools.extern.packaging.version import LegacyVersion, parse
from
setuptools.extern.six
import
string_types
__metaclass__
=
type
def
read_configuration
(
filepath
,
find_others
=
False
,
ignore_option_errors
=
False
):
"""Read given configuration file and returns options from it as a dict.
...
...
@@ -113,7 +116,7 @@ def parse_configuration(
return
meta
,
options
class
ConfigHandler
(
object
)
:
class
ConfigHandler
:
"""Handles metadata supplied in configuration files."""
section_prefix
=
None
...
...
setuptools/package_index.py
View file @
cca86c7f
...
...
@@ -26,6 +26,8 @@ from setuptools.py27compat import get_all_headers
from
setuptools.py33compat
import
unescape
from
setuptools.wheel
import
Wheel
__metaclass__
=
type
EGG_FRAGMENT
=
re
.
compile
(
r'^egg=([-A-Za-z0-9_.+!]+)$'
)
HREF
=
re
.
compile
(
"""href
\
\
s*=
\
\
s*['"]?([^'"> ]+)"""
,
re
.
I
)
# this is here to fix emacs' cruddy broken syntax highlighting
...
...
@@ -235,7 +237,7 @@ def find_external_links(url, page):
yield urllib.parse.urljoin(url, htmldecode(match.group(1)))
class ContentChecker
(object)
:
class ContentChecker:
"""
A
null
content
checker
that
defines
the
interface
for
checking
content
"""
...
...
@@ -980,7 +982,7 @@ def _encode_auth(auth):
return encoded.replace('
\
n
', '')
class Credential
(object)
:
class Credential:
"""
A
username
/
password
pair
.
Use
like
a
namedtuple
.
"""
...
...
setuptools/py31compat.py
View file @
cca86c7f
__all__
=
[]
__metaclass__
=
type
try
:
# Python >=3.2
from
tempfile
import
TemporaryDirectory
...
...
@@ -7,7 +10,7 @@ except ImportError:
import
shutil
import
tempfile
class
TemporaryDirectory
(
object
)
:
class
TemporaryDirectory
:
"""
Very simple temporary directory context manager.
Will try to delete afterward, but will also ignore OS and similar
...
...
setuptools/py33compat.py
View file @
cca86c7f
...
...
@@ -10,11 +10,12 @@ except ImportError:
from
setuptools.extern
import
six
from
setuptools.extern.six.moves
import
html_parser
__metaclass__
=
type
OpArg
=
collections
.
namedtuple
(
'OpArg'
,
'opcode arg'
)
class
Bytecode_compat
(
object
)
:
class
Bytecode_compat
:
def
__init__
(
self
,
code
):
self
.
code
=
code
...
...
setuptools/tests/test_build_meta.py
View file @
cca86c7f
...
...
@@ -5,12 +5,14 @@ import pytest
from
.files
import
build_files
from
.textwrap
import
DALS
__metaclass__
=
type
futures
=
pytest
.
importorskip
(
'concurrent.futures'
)
importlib
=
pytest
.
importorskip
(
'importlib'
)
class
BuildBackendBase
(
object
)
:
class
BuildBackendBase
:
def
__init__
(
self
,
cwd
=
None
,
env
=
{},
backend_name
=
'setuptools.build_meta'
):
self
.
cwd
=
cwd
self
.
env
=
env
...
...
setuptools/tests/test_easy_install.py
View file @
cca86c7f
...
...
@@ -36,8 +36,10 @@ import pkg_resources
from
.
import
contexts
from
.textwrap
import
DALS
__metaclass__
=
type
class
FakeDist
(
object
):
class
FakeDist
:
def
get_entry_map
(
self
,
group
):
if
group
!=
'console_scripts'
:
return
{}
...
...
setuptools/tests/test_egg_info.py
View file @
cca86c7f
...
...
@@ -16,12 +16,14 @@ from .files import build_files
from
.textwrap
import
DALS
from
.
import
contexts
__metaclass__
=
type
class
Environment
(
str
):
pass
class
TestEggInfo
(
object
)
:
class
TestEggInfo
:
setup_script
=
DALS
(
"""
from setuptools import setup
...
...
@@ -181,7 +183,7 @@ class TestEggInfo(object):
)
invalid_marker
=
"<=>++"
class
RequiresTestHelper
(
object
)
:
class
RequiresTestHelper
:
@
staticmethod
def
parametrize
(
*
test_list
,
**
format_dict
):
...
...
setuptools/tests/test_glibc.py
View file @
cca86c7f
...
...
@@ -4,6 +4,8 @@ import pytest
from
setuptools.glibc
import
check_glibc_version
__metaclass__
=
type
@
pytest
.
fixture
(
params
=
[
"2.20"
,
...
...
@@ -23,7 +25,7 @@ def bad_string(request):
return
request
.
param
class
TestGlibc
(
object
)
:
class
TestGlibc
:
def
test_manylinux1_check_glibc_version
(
self
,
two_twenty
):
"""
Test that the check_glibc_version function is robust against weird
...
...
setuptools/tests/test_manifest.py
View file @
cca86c7f
...
...
@@ -18,6 +18,8 @@ from setuptools.tests.textwrap import DALS
import
pytest
__metaclass__
=
type
py3_only
=
pytest
.
mark
.
xfail
(
six
.
PY2
,
reason
=
"Test runs on Python 3 only"
)
...
...
@@ -157,7 +159,7 @@ def test_translated_pattern_mismatch(pattern_mismatch):
assert
not
translate_pattern
(
pattern
).
match
(
target
)
class
TempDirTestCase
(
object
)
:
class
TempDirTestCase
:
def
setup_method
(
self
,
method
):
self
.
temp_dir
=
tempfile
.
mkdtemp
()
self
.
old_cwd
=
os
.
getcwd
()
...
...
setuptools/tests/test_pep425tags.py
View file @
cca86c7f
...
...
@@ -4,8 +4,10 @@ from mock import patch
from
setuptools
import
pep425tags
__metaclass__
=
type
class
TestPEP425Tags
(
object
):
class
TestPEP425Tags
:
def
mock_get_config_var
(
self
,
**
kwd
):
"""
...
...
@@ -104,7 +106,7 @@ class TestPEP425Tags(object):
self
.
abi_tag_unicode
(
'dm'
,
{
'Py_DEBUG'
:
True
,
'WITH_PYMALLOC'
:
True
})
class
TestManylinux1Tags
(
object
)
:
class
TestManylinux1Tags
:
@
patch
(
'setuptools.pep425tags.get_platform'
,
lambda
:
'linux_x86_64'
)
@
patch
(
'setuptools.glibc.have_compatible_glibc'
,
...
...
setuptools/tests/test_wheel.py
View file @
cca86c7f
...
...
@@ -24,6 +24,8 @@ from .contexts import tempdir
from
.files
import
build_files
from
.textwrap
import
DALS
__metaclass__
=
type
WHEEL_INFO_TESTS
=
(
(
'invalid.whl'
,
ValueError
),
...
...
@@ -148,7 +150,7 @@ def _check_wheel_install(filename, install_dir, install_tree_includes,
assert
requires_txt
==
dist
.
get_metadata
(
'requires.txt'
).
lstrip
()
class
Record
(
object
)
:
class
Record
:
def
__init__
(
self
,
id
,
**
kwargs
):
self
.
_id
=
id
...
...
setuptools/wheel.py
View file @
cca86c7f
...
...
@@ -16,6 +16,9 @@ from setuptools import pep425tags
from
setuptools.command.egg_info
import
write_requirements
__metaclass__
=
type
WHEEL_NAME
=
re
.
compile
(
r"""^(?P<project_name>.+?)-(?P<version>\
d.*?)
((-(?P<build>\
d.*?))?-(?P<py_
version>.+?)-(?P<abi>.+?)-(?P<platform>.+?)
...
...
@@ -52,7 +55,7 @@ def unpack(src_dir, dst_dir):
os.rmdir(dirpath)
class Wheel
(object)
:
class Wheel:
def __init__(self, filename):
match = WHEEL_NAME(os.path.basename(filename))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment