Skip to content

Python 3.13, site-packages and SDK 2013 update #508

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 39 commits into from
Apr 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
13492ea
First part of Win update
Ayuto Apr 1, 2025
284fe5b
Update Python
Ayuto Apr 1, 2025
e32e72b
Fixed dict usage before Python initialization (thanks to spitice)
Ayuto Apr 15, 2025
a1bf96d
Fix Python initialization
Ayuto Apr 15, 2025
e84647e
Update site packages
Ayuto Apr 16, 2025
8f691e4
Fixes due to updated path library
Ayuto Apr 16, 2025
f3f1647
Fix cmake deprecation warnings
Ayuto Apr 16, 2025
061c063
OB SDK fixes
Ayuto Apr 16, 2025
6ac5afe
Fix deprecated datetime function.
Ayuto Apr 16, 2025
81c5b67
Remove tf2 patches
Ayuto Apr 16, 2025
a45cd6e
Remove hl2dm patches
Ayuto Apr 16, 2025
30b818b
Remove patched tier1 for l4d2
Ayuto Apr 16, 2025
977f87c
Fix SDK link libs
Ayuto Apr 16, 2025
7e9a70d
Fix gmod
Ayuto Apr 16, 2025
91691e6
Remove bms patch and fix compilation
Ayuto Apr 16, 2025
28750cd
Remove blade patch
Ayuto Apr 16, 2025
685d27c
Update documentation
Ayuto Apr 16, 2025
2d7e65c
Updated docs for building
Ayuto Apr 16, 2025
732b121
Add static AsmJit lib for Linux
Ayuto Apr 17, 2025
5b9d787
Add static DynamicHooks lib for Linux
Ayuto Apr 17, 2025
740e098
Python update linux
Ayuto Apr 17, 2025
835bc69
32bit Python...
Ayuto Apr 17, 2025
a2e6639
Added Boost libs
Ayuto Apr 17, 2025
cee5da7
Fix link libraries
Ayuto Apr 17, 2025
76171e7
Final fixes
Ayuto Apr 17, 2025
5499de4
Fix path to sqlite lib
Ayuto Apr 17, 2025
081c601
Add sysconfigdata
Ayuto Apr 17, 2025
5f50c5b
Merge branch 'master' into py313
Ayuto Apr 18, 2025
c1836ae
Fix some Sphinx warnings
Ayuto Apr 18, 2025
2b6018a
Add requirements.txt
Ayuto Apr 18, 2025
4b63c1a
Accidentally installed the wrong arch...
Ayuto Apr 18, 2025
3cfe784
Add Linux site-packages
Ayuto Apr 18, 2025
092a33c
Fix documentation
Ayuto Apr 18, 2025
0eea28b
Use c++17
Ayuto Apr 18, 2025
3ba852d
Patches for bms and gmod (use V_swap instead of swap)
Ayuto Apr 18, 2025
0ee352f
PRs have been merged already
Ayuto Apr 18, 2025
720c2df
Use devenv to build Win from cmd
Ayuto Apr 18, 2025
2cba278
Also clear site-packages when updating
Ayuto Apr 18, 2025
a1b20f8
Updated requirements doc
Ayuto Apr 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
49 changes: 28 additions & 21 deletions addons/source-python/Python3/__future__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
to use the feature in question, but may continue to use such imports.

MandatoryRelease may also be None, meaning that a planned feature got
dropped.
dropped or that the release version is undetermined.

Instances of class _Feature have two corresponding methods,
.getOptionalRelease() and .getMandatoryRelease().
Expand All @@ -42,7 +42,7 @@
argument to the builtin function compile() to enable the feature in
dynamically compiled code. This flag is stored in the .compiler_flag
attribute on _Future instances. These values must match the appropriate
#defines of CO_xxx flags in Include/compile.h.
#defines of CO_xxx flags in Include/cpython/compile.h.

No feature line is ever to be deleted from this file.
"""
Expand All @@ -57,25 +57,29 @@
"unicode_literals",
"barry_as_FLUFL",
"generator_stop",
"annotations",
]

__all__ = ["all_feature_names"] + all_feature_names

# The CO_xxx symbols are defined here under the same names used by
# compile.h, so that an editor search will find them here. However,
# they're not exported in __all__, because they don't really belong to
# The CO_xxx symbols are defined here under the same names defined in
# code.h and used by compile.h, so that an editor search will find them here.
# However, they're not exported in __all__, because they don't really belong to
# this module.
CO_NESTED = 0x0010 # nested_scopes
CO_GENERATOR_ALLOWED = 0 # generators (obsolete, was 0x1000)
CO_FUTURE_DIVISION = 0x2000 # division
CO_FUTURE_ABSOLUTE_IMPORT = 0x4000 # perform absolute imports by default
CO_FUTURE_WITH_STATEMENT = 0x8000 # with statement
CO_FUTURE_PRINT_FUNCTION = 0x10000 # print function
CO_FUTURE_UNICODE_LITERALS = 0x20000 # unicode string literals
CO_FUTURE_BARRY_AS_BDFL = 0x40000
CO_FUTURE_GENERATOR_STOP = 0x80000 # StopIteration becomes RuntimeError in generators
CO_NESTED = 0x0010 # nested_scopes
CO_GENERATOR_ALLOWED = 0 # generators (obsolete, was 0x1000)
CO_FUTURE_DIVISION = 0x20000 # division
CO_FUTURE_ABSOLUTE_IMPORT = 0x40000 # perform absolute imports by default
CO_FUTURE_WITH_STATEMENT = 0x80000 # with statement
CO_FUTURE_PRINT_FUNCTION = 0x100000 # print function
CO_FUTURE_UNICODE_LITERALS = 0x200000 # unicode string literals
CO_FUTURE_BARRY_AS_BDFL = 0x400000
CO_FUTURE_GENERATOR_STOP = 0x800000 # StopIteration becomes RuntimeError in generators
CO_FUTURE_ANNOTATIONS = 0x1000000 # annotations become strings at runtime


class _Feature:

def __init__(self, optionalRelease, mandatoryRelease, compiler_flag):
self.optional = optionalRelease
self.mandatory = mandatoryRelease
Expand All @@ -86,23 +90,22 @@ def getOptionalRelease(self):

This is a 5-tuple, of the same form as sys.version_info.
"""

return self.optional

def getMandatoryRelease(self):
"""Return release in which this feature will become mandatory.

This is a 5-tuple, of the same form as sys.version_info, or, if
the feature was dropped, is None.
the feature was dropped, or the release date is undetermined, is None.
"""

return self.mandatory

def __repr__(self):
return "_Feature" + repr((self.optional,
self.mandatory,
self.compiler_flag))


nested_scopes = _Feature((2, 1, 0, "beta", 1),
(2, 2, 0, "alpha", 0),
CO_NESTED)
Expand Down Expand Up @@ -132,9 +135,13 @@ def __repr__(self):
CO_FUTURE_UNICODE_LITERALS)

barry_as_FLUFL = _Feature((3, 1, 0, "alpha", 2),
(3, 9, 0, "alpha", 0),
CO_FUTURE_BARRY_AS_BDFL)
(4, 0, 0, "alpha", 0),
CO_FUTURE_BARRY_AS_BDFL)

generator_stop = _Feature((3, 5, 0, "beta", 1),
(3, 7, 0, "alpha", 0),
CO_FUTURE_GENERATOR_STOP)
(3, 7, 0, "alpha", 0),
CO_FUTURE_GENERATOR_STOP)

annotations = _Feature((3, 7, 0, "beta", 1),
None,
CO_FUTURE_ANNOTATIONS)
16 changes: 16 additions & 0 deletions addons/source-python/Python3/__hello__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
initialized = True

class TestFrozenUtf8_1:
"""\u00b6"""

class TestFrozenUtf8_2:
"""\u03c0"""

class TestFrozenUtf8_4:
"""\U0001f600"""

def main():
print("Hello world!")

if __name__ == '__main__':
main()
1 change: 0 additions & 1 deletion addons/source-python/Python3/__phello__.foo.py

This file was deleted.

7 changes: 7 additions & 0 deletions addons/source-python/Python3/__phello__/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
initialized = True

def main():
print("Hello world!")

if __name__ == '__main__':
main()
Empty file.
Empty file.
7 changes: 7 additions & 0 deletions addons/source-python/Python3/__phello__/spam.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
initialized = True

def main():
print("Hello world!")

if __name__ == '__main__':
main()
108 changes: 108 additions & 0 deletions addons/source-python/Python3/_aix_support.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
"""Shared AIX support functions."""

import sys
import sysconfig


# Taken from _osx_support _read_output function
def _read_cmd_output(commandstring, capture_stderr=False):
"""Output from successful command execution or None"""
# Similar to os.popen(commandstring, "r").read(),
# but without actually using os.popen because that
# function is not usable during python bootstrap.
import os
import contextlib
fp = open("/tmp/_aix_support.%s"%(
os.getpid(),), "w+b")

with contextlib.closing(fp) as fp:
if capture_stderr:
cmd = "%s >'%s' 2>&1" % (commandstring, fp.name)
else:
cmd = "%s 2>/dev/null >'%s'" % (commandstring, fp.name)
return fp.read() if not os.system(cmd) else None


def _aix_tag(vrtl, bd):
# type: (List[int], int) -> str
# Infer the ABI bitwidth from maxsize (assuming 64 bit as the default)
_sz = 32 if sys.maxsize == (2**31-1) else 64
_bd = bd if bd != 0 else 9988
# vrtl[version, release, technology_level]
return "aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(vrtl[0], vrtl[1], vrtl[2], _bd, _sz)


# extract version, release and technology level from a VRMF string
def _aix_vrtl(vrmf):
# type: (str) -> List[int]
v, r, tl = vrmf.split(".")[:3]
return [int(v[-1]), int(r), int(tl)]


def _aix_bos_rte():
# type: () -> Tuple[str, int]
"""
Return a Tuple[str, int] e.g., ['7.1.4.34', 1806]
The fileset bos.rte represents the current AIX run-time level. It's VRMF and
builddate reflect the current ABI levels of the runtime environment.
If no builddate is found give a value that will satisfy pep425 related queries
"""
# All AIX systems to have lslpp installed in this location
# subprocess may not be available during python bootstrap
try:
import subprocess
out = subprocess.check_output(["/usr/bin/lslpp", "-Lqc", "bos.rte"])
except ImportError:
out = _read_cmd_output("/usr/bin/lslpp -Lqc bos.rte")
out = out.decode("utf-8")
out = out.strip().split(":") # type: ignore
_bd = int(out[-1]) if out[-1] != '' else 9988
return (str(out[2]), _bd)


def aix_platform():
# type: () -> str
"""
AIX filesets are identified by four decimal values: V.R.M.F.
V (version) and R (release) can be retrieved using ``uname``
Since 2007, starting with AIX 5.3 TL7, the M value has been
included with the fileset bos.rte and represents the Technology
Level (TL) of AIX. The F (Fix) value also increases, but is not
relevant for comparing releases and binary compatibility.
For binary compatibility the so-called builddate is needed.
Again, the builddate of an AIX release is associated with bos.rte.
AIX ABI compatibility is described as guaranteed at: https://www.ibm.com/\
support/knowledgecenter/en/ssw_aix_72/install/binary_compatability.html

For pep425 purposes the AIX platform tag becomes:
"aix-{:1x}{:1d}{:02d}-{:04d}-{}".format(v, r, tl, builddate, bitsize)
e.g., "aix-6107-1415-32" for AIX 6.1 TL7 bd 1415, 32-bit
and, "aix-6107-1415-64" for AIX 6.1 TL7 bd 1415, 64-bit
"""
vrmf, bd = _aix_bos_rte()
return _aix_tag(_aix_vrtl(vrmf), bd)


# extract vrtl from the BUILD_GNU_TYPE as an int
def _aix_bgt():
# type: () -> List[int]
gnu_type = sysconfig.get_config_var("BUILD_GNU_TYPE")
if not gnu_type:
raise ValueError("BUILD_GNU_TYPE is not defined")
return _aix_vrtl(vrmf=gnu_type)


def aix_buildtag():
# type: () -> str
"""
Return the platform_tag of the system Python was built on.
"""
# AIX_BUILDDATE is defined by configure with:
# lslpp -Lcq bos.rte | awk -F: '{ print $NF }'
build_date = sysconfig.get_config_var("AIX_BUILDDATE")
try:
build_date = int(build_date)
except (ValueError, TypeError):
raise ValueError(f"AIX_BUILDDATE is not defined or invalid: "
f"{build_date!r}")
return _aix_tag(_aix_bgt(), build_date)
Loading