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 1 commit
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes due to updated path library
  • Loading branch information
Ayuto committed Apr 16, 2025
commit 8f691e41b7786b7122dbeee40eedb20a3fe85c0c
6 changes: 3 additions & 3 deletions addons/source-python/packages/source-python/autodoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ def project_exists(self):

:rtype: bool
"""
return self.project_dir.isdir()
return self.project_dir.is_dir()

def package_exists(self):
"""Return True if the package exists.

:rtype: bool
"""
return self.package_dir.isdir()
return self.package_dir.is_dir()

def create(self, author, project_name=None, version='1'):
"""Create a new Sphinx project.
Expand Down Expand Up @@ -117,7 +117,7 @@ def create(self, author, project_name=None, version='1'):
]

if project_name is None:
project_name = self.package_dir.namebase
project_name = self.package_dir.name

argv.append('-p {0}'.format(project_name))
argv.append('-a {0}'.format(author))
Expand Down
6 changes: 3 additions & 3 deletions addons/source-python/packages/source-python/config/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ def write(self):
self._indention = 3

# Do all directories to the file exist?
if not self.fullpath.parent.isdir():
if not self.fullpath.parent.is_dir():

# Create the directories
self.fullpath.parent.makedirs()
Expand Down Expand Up @@ -325,7 +325,7 @@ def write(self):
def execute(self):
"""Execute the config file."""
# Does the file exist?
if not self.fullpath.isfile():
if not self.fullpath.is_file():
raise FileNotFoundError(
'Cannot execute file "{0}", file not found'.format(
self.fullpath))
Expand Down Expand Up @@ -381,7 +381,7 @@ def _parse_old_file(self):
_old_config = defaultdict(list)

# Does the file exist?
if not self.fullpath.isfile():
if not self.fullpath.is_file():

# If not, simply return the empty dictionary
return _old_config
Expand Down
6 changes: 3 additions & 3 deletions addons/source-python/packages/source-python/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
# >> GLOBAL VARIABLES
# =============================================================================
# Get the specific game for the server
GAME_NAME = GAME_PATH.namebase
GAME_NAME = GAME_PATH.name

# Get the platform the server is on
PLATFORM = system().lower()
Expand Down Expand Up @@ -238,11 +238,11 @@ def __init__(
argument lists.
"""
# If the given path doesn't exist, search for it in the cfg directory
if not path.isfile():
if not path.is_file():
path = CFG_PATH.joinpath(path)

# If no file was found, return an empty list
if not path.isfile():
if not path.is_file():
return

# Import this here to fix cyclic imports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def _prepare_generated_source_python_file(file_path):
"""
new_name = file_path.parent / file_path.basename().replace(
'source-python.', '')
if new_name.isfile():
if new_name.is_file():
file_path.remove()
return

Expand Down Expand Up @@ -445,13 +445,13 @@ def is_source_python(package):
def is_custom_package(package):
"""Return True if the given package name is a custom package."""
return package in map(
lambda path: str(path.namebase), CUSTOM_PACKAGES_PATH.listdir())
lambda path: str(path.name), CUSTOM_PACKAGES_PATH.listdir())


def is_plugin(package):
"""Return True if the given package name is a plugin."""
return package in map(
lambda path: str(path.namebase), PLUGIN_PATH.dirs())
lambda path: str(path.name), PLUGIN_PATH.dirs())


# =============================================================================
Expand Down
12 changes: 6 additions & 6 deletions addons/source-python/packages/source-python/core/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _clean_update_dir():
"""Clear or create the update directory."""
if UPDATE_PATH.exists():
for f in UPDATE_PATH.listdir():
if f.isfile():
if f.is_file():
f.remove()
else:
f.rmtree()
Expand Down Expand Up @@ -200,12 +200,12 @@ def _apply_update_stage1():
_apply_update_stage1_linux()

# Apply latest data update
if not DATA_ZIP_FILE.isfile():
if not DATA_ZIP_FILE.is_file():
return

update_logger.log_debug('Applying latest data update...')

if UPDATE_SP_DATA_PATH.isdir():
if UPDATE_SP_DATA_PATH.is_dir():
update_logger.log_debug(f'Removing {UPDATE_SP_DATA_PATH} ...')
UPDATE_SP_DATA_PATH.rmtree()

Expand All @@ -221,7 +221,7 @@ def _apply_update_stage1_windows():
to point to the new loader.
If ``source-python.vdf`` does not exist, manual action is required.
"""
if not VDF_FILE.isfile():
if not VDF_FILE.is_file():
update_logger.log_message(
f'Stage 1 has been applied. Please shutdown your server and move '
f'(do not copy) {LOADER_UPDATE_FILE} to {LOADER_FILE}. After that '
Expand Down Expand Up @@ -272,7 +272,7 @@ def update_data(timeout=DEFAULT_TIMEOUT):
Number of seconds that need to pass until a timeout occurs.
"""
_download_latest_data(timeout)
if SP_DATA_PATH.isdir():
if SP_DATA_PATH.is_dir():
update_logger.log_debug('Removing {} ...'.format(SP_DATA_PATH))
SP_DATA_PATH.rmtree()

Expand All @@ -285,7 +285,7 @@ def is_new_data_available(timeout=DEFAULT_TIMEOUT):
Number of seconds that need to pass until a timeout occurs.
:rtype: bool
"""
if not DATA_ZIP_FILE.isfile():
if not DATA_ZIP_FILE.is_file():
return True

return DATA_ZIP_FILE.read_hexhash('md5') != get_latest_data_checksum(timeout)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
# =============================================================================
if SP_PACKAGES_PATH.joinpath(
'entities', 'engines', SOURCE_ENGINE, GAME_NAME + '.py'
).isfile():
).is_file():

# Import the game-specific 'Entity' class
Entity = entities._base.Entity = import_module(
Expand All @@ -52,7 +52,7 @@

elif SP_PACKAGES_PATH.joinpath(
'entities', 'engines', SOURCE_ENGINE, '__init__.py'
).isfile():
).is_file():

# Import the engine-specific 'Entity' class
Entity = entities._base.Entity = import_module(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def fullpath(self):
def write(self):
"""Write the .res file to disk."""
# Does the director for the .res file exist?
if not self.fullpath.parent.isdir():
if not self.fullpath.parent.is_dir():

# Create the directory
self.fullpath.parent.makedirs()
Expand Down
2 changes: 1 addition & 1 deletion addons/source-python/packages/source-python/loggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def __init__(
log_path = LOG_PATH / filepath + '.log'

# Does the parent directory exist?
if not log_path.parent.isdir():
if not log_path.parent.is_dir():

# Create the parent directory
log_path.parent.makedirs()
Expand Down
4 changes: 2 additions & 2 deletions addons/source-python/packages/source-python/players/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# =============================================================================
if SP_PACKAGES_PATH.joinpath(
'players', 'engines', SOURCE_ENGINE, GAME_NAME + '.py'
).isfile():
).is_file():

# Import the game-specific 'Player' class
Player = players._base.Player = import_module(
Expand All @@ -43,7 +43,7 @@

elif SP_PACKAGES_PATH.joinpath(
'players', 'engines', SOURCE_ENGINE, '__init__.py'
).isfile():
).is_file():

# Import the engine-specific 'Player' class
Player = players._base.Player = import_module(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def plugins(self):
:rtype: generator
"""
for path in self.plugins_directory.dirs():
plugin_name = path.namebase
plugin_name = path.name
if not self.is_valid_plugin_name(plugin_name):
continue

Expand Down Expand Up @@ -176,7 +176,7 @@ def load(self, plugin_name):
'"{}" is an invalid plugin name.'.format(plugin_name))

plugin = self._create_plugin_instance(plugin_name)
if not plugin.file_path.isfile():
if not plugin.file_path.is_file():
raise PluginFileNotFoundError(
'File {} does not exist.'.format(plugin.file_path))

Expand Down Expand Up @@ -284,7 +284,7 @@ def plugin_exists(self, plugin_name):
The plugin to check.
:rtype: bool
"""
return self.get_plugin_file_path(plugin_name).isfile()
return self.get_plugin_file_path(plugin_name).is_file()

def get_plugin_instance(self, plugin_name):
"""Return a plugin's instance, if it is loaded.
Expand Down Expand Up @@ -357,7 +357,7 @@ def _create_plugin_info(self, plugin_name):
'Plugin "{}" does not exist.'.format(plugin_name))

info_file = self.get_plugin_directory(plugin_name) / 'info.ini'
if not info_file.isfile():
if not info_file.is_file():
# Just return an "empty" PluginInfo instance. We don't have more
# information.
return PluginInfo(plugin_name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
_STORAGE_PATH = SP_DATA_PATH / 'settings' / 'users.db'

# Does the ../data/source-python/settings/ directory exist?
if not _STORAGE_PATH.parent.isdir():
if not _STORAGE_PATH.parent.is_dir():

# Create the ../data/source-python/settings/ directory
_STORAGE_PATH.parent.mkdir()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ def __init__(self, infile, encoding='utf_8'):
self._encoding = encoding

# Does the file exist?
if not self._mainfile.isfile():
if not self._mainfile.is_file():

# Raise an error
raise FileNotFoundError(
'No file found at {0}'.format(self._mainfile))

# Get the path to the server specific file
self._serverfile = self._mainfile.parent / '{0}_server.ini'.format(
self._mainfile.namebase)
self._mainfile.name)

# Get the strings from the main file
main_strings = GameConfigObj(self._mainfile, encoding=encoding)

# Does the server specific file exist?
if not self._serverfile.isfile() and not infile.startswith('_core/'):
if not self._serverfile.is_file() and not infile.startswith('_core/'):

# Create the server specific file
self._create_server_file()
Expand Down
4 changes: 2 additions & 2 deletions addons/source-python/packages/source-python/weapons/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
# =============================================================================
if SP_PACKAGES_PATH.joinpath(
'weapons', 'engines', SOURCE_ENGINE, GAME_NAME + '.py'
).isfile():
).is_file():

# Import the game-specific 'Weapon' class
Weapon = weapons._base.Weapon = import_module(
Expand All @@ -43,7 +43,7 @@

elif SP_PACKAGES_PATH.joinpath(
'weapons', 'engines', SOURCE_ENGINE, '__init__.py'
).isfile():
).is_file():

# Import the engine-specific 'Weapon' class
Weapon = weapons._base.Weapon = import_module(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def tags(self):
return self._tags

# Does the current game have an ini file?
if _gamepath.isfile():
if _gamepath.is_file():

# Get the _WeaponManager instance
weapon_manager = _WeaponManager()
Expand Down