Skip to content

Commit

Permalink
Fixes for Python 3.12
Browse files Browse the repository at this point in the history
fixes #888
  • Loading branch information
arcivanov committed Jul 9, 2023
1 parent b5f2bac commit d72f2b3
Show file tree
Hide file tree
Showing 150 changed files with 4,153 additions and 2,504 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pybuilder.yml
Expand Up @@ -14,6 +14,7 @@ jobs:
os:
- ubuntu-latest
python-version:
- '3.12-dev'
- '3.11'
- '3.10'
- '3.9'
Expand All @@ -33,7 +34,7 @@ jobs:
python-version: '${{ matrix.python-version }}'
with-venv: '${{ matrix.with-venv }}'
with-homebrew: 'false'
deploy-on-python: '["3.10"]'
deploy-on-python: '["3.11"]'
deploy-on-os: '["Linux"]'
deploy-on-branch: '["refs/heads/master"]'
build-secondary:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -19,7 +19,7 @@ PyBuilder is based on the concept of dependency based programming, but it also
comes with a powerful plugin mechanism, allowing the construction of build life
cycles similar to those known from other famous (Java) build tools.

PyBuilder is running on the following versions of Python 3.7, 3.8, 3.9, 3.10, 3.11 and PyPy 3.7, 3.8 and 3.9.
PyBuilder is running on the following versions of Python 3.7, 3.8, 3.9, 3.10, 3.11, 3.12 and PyPy 3.7, 3.8 and 3.9.

See the [GitHub Actions Workflow](https://github.com/pybuilder/pybuilder/actions/workflows/pybuilder.yml) for version specific output.

Expand Down
1 change: 1 addition & 0 deletions build.py
Expand Up @@ -181,6 +181,7 @@ def initialize(project):
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: MacOS :: MacOS X",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -51,4 +51,5 @@
subprocess.check_call([sys.executable, "setup.py"] + setup_args, cwd=script_dir)
except subprocess.CalledProcessError as e:
exit_code = e.returncode
sys.exit(exit_code)
if exit_code:
sys.exit(exit_code)
2 changes: 1 addition & 1 deletion src/integrationtest/python/issue_807_tests.py
Expand Up @@ -47,7 +47,7 @@ def init (project):
from importlib import metadata
def run_code():
return metadata.version("setuptools")
return metadata.version("pip")
"""))
self.write_file("src/unittest/python/code_tests.py", textwrap.dedent(
"""
Expand Down
41 changes: 32 additions & 9 deletions src/main/python/pybuilder/_vendor/LICENSES
Expand Up @@ -410,10 +410,8 @@ importlib_resources-5.12.0
limitations under the License.


setuptools-67.4.0
setuptools-68.0.0
==========
Copyright Jason R. Coombs

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
Expand Down Expand Up @@ -457,7 +455,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWIS
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.


zipp-3.14.0
zipp-3.15.0
==========
Copyright Jason R. Coombs

Expand Down Expand Up @@ -789,18 +787,18 @@ THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

typing_extensions-4.5.0
typing_extensions-4.7.1
==========
A. HISTORY OF THE SOFTWARE
==========================

Python was created in the early 1990s by Guido van Rossum at Stichting
Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands
Mathematisch Centrum (CWI, see https://www.cwi.nl) in the Netherlands
as a successor of a language called ABC. Guido remains Python's
principal author, although it includes many contributions from others.

In 1995, Guido continued his work on Python at the Corporation for
National Research Initiatives (CNRI, see http://www.cnri.reston.va.us)
National Research Initiatives (CNRI, see https://www.cnri.reston.va.us)
in Reston, Virginia where he released several versions of the
software.

Expand All @@ -812,7 +810,7 @@ https://www.python.org/psf/) was formed, a non-profit organization
created specifically to own Python-related Intellectual Property.
Zope Corporation was a sponsoring member of the PSF.

All Python releases are Open Source (see http://www.opensource.org for
All Python releases are Open Source (see https://opensource.org for
the Open Source Definition). Historically, most, but not all, Python
releases have also been GPL-compatible; the table below summarizes
the various releases.
Expand Down Expand Up @@ -852,6 +850,17 @@ direction to make these releases possible.
B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON
===============================================================

Python software and documentation are licensed under the
Python Software Foundation License Version 2.

Starting with Python 3.8.6, examples, recipes, and other code in
the documentation are dual licensed under the PSF License Version 2
and the Zero-Clause BSD license.

Some software incorporated into Python is under different licenses.
The licenses are listed with code falling under that license.


PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2
--------------------------------------------

Expand All @@ -866,7 +875,7 @@ analyze, test, perform and/or display publicly, prepare derivative works,
distribute, and otherwise use Python alone or in any derivative version,
provided, however, that PSF's License Agreement and PSF's notice of copyright,
i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Python Software Foundation;
2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 Python Software Foundation;
All Rights Reserved" are retained in Python alone or in any derivative version
prepared by Licensee.

Expand Down Expand Up @@ -1046,4 +1055,18 @@ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

ZERO-CLAUSE BSD LICENSE FOR CODE IN THE PYTHON DOCUMENTATION
----------------------------------------------------------------------

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.


11 changes: 8 additions & 3 deletions src/main/python/pybuilder/_vendor/_distutils_hack/__init__.py
Expand Up @@ -142,7 +142,7 @@ def spec_for_pip(self):
Ensure stdlib distutils when running under pip.
See pypa/pip#8761 for rationale.
"""
if self.pip_imported_during_build():
if sys.version_info >= (3, 12) or self.pip_imported_during_build():
return
clear_distutils()
self.spec_for_distutils = lambda: None
Expand Down Expand Up @@ -208,15 +208,20 @@ def __enter__(self):
insert_shim()

def __exit__(self, exc, value, tb):
remove_shim()
_remove_shim()


def insert_shim():
sys.meta_path.insert(0, DISTUTILS_FINDER)


def remove_shim():
def _remove_shim():
try:
sys.meta_path.remove(DISTUTILS_FINDER)
except ValueError:
pass


if sys.version_info < (3, 12):
# DistutilsMetaFinder can only be disabled in Python < 3.12 (PEP 632)
remove_shim = _remove_shim
9 changes: 4 additions & 5 deletions src/main/python/pybuilder/_vendor/filelock/__init__.py
Expand Up @@ -25,18 +25,17 @@
if sys.platform == "win32": # pragma: win32 cover
_FileLock: type[BaseFileLock] = WindowsFileLock
else: # pragma: win32 no cover
if has_fcntl:
if has_fcntl: # noqa: PLR5501
_FileLock: type[BaseFileLock] = UnixFileLock
else:
_FileLock = SoftFileLock
if warnings is not None:
warnings.warn("only soft file lock is available")
warnings.warn("only soft file lock is available", stacklevel=2)

#: Alias for the lock, which should be used for the current platform. On Windows, this is an alias for
# :class:`WindowsFileLock`, on Unix for :class:`UnixFileLock` and otherwise for :class:`SoftFileLock`.
if TYPE_CHECKING:
if TYPE_CHECKING: # noqa: SIM108
FileLock = SoftFileLock
else:
#: Alias for the lock, which should be used for the current platform.
FileLock = _FileLock


Expand Down

0 comments on commit d72f2b3

Please sign in to comment.