Skip to content

Commit 8f691e4

Browse files
committed
Fixes due to updated path library
1 parent e84647e commit 8f691e4

File tree

14 files changed

+35
-35
lines changed

14 files changed

+35
-35
lines changed

addons/source-python/packages/source-python/autodoc.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ def project_exists(self):
7777
7878
:rtype: bool
7979
"""
80-
return self.project_dir.isdir()
80+
return self.project_dir.is_dir()
8181

8282
def package_exists(self):
8383
"""Return True if the package exists.
8484
8585
:rtype: bool
8686
"""
87-
return self.package_dir.isdir()
87+
return self.package_dir.is_dir()
8888

8989
def create(self, author, project_name=None, version='1'):
9090
"""Create a new Sphinx project.
@@ -117,7 +117,7 @@ def create(self, author, project_name=None, version='1'):
117117
]
118118

119119
if project_name is None:
120-
project_name = self.package_dir.namebase
120+
project_name = self.package_dir.name
121121

122122
argv.append('-p {0}'.format(project_name))
123123
argv.append('-a {0}'.format(author))

addons/source-python/packages/source-python/config/manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def write(self):
259259
self._indention = 3
260260

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

264264
# Create the directories
265265
self.fullpath.parent.makedirs()
@@ -325,7 +325,7 @@ def write(self):
325325
def execute(self):
326326
"""Execute the config file."""
327327
# Does the file exist?
328-
if not self.fullpath.isfile():
328+
if not self.fullpath.is_file():
329329
raise FileNotFoundError(
330330
'Cannot execute file "{0}", file not found'.format(
331331
self.fullpath))
@@ -381,7 +381,7 @@ def _parse_old_file(self):
381381
_old_config = defaultdict(list)
382382

383383
# Does the file exist?
384-
if not self.fullpath.isfile():
384+
if not self.fullpath.is_file():
385385

386386
# If not, simply return the empty dictionary
387387
return _old_config

addons/source-python/packages/source-python/core/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
# >> GLOBAL VARIABLES
9191
# =============================================================================
9292
# Get the specific game for the server
93-
GAME_NAME = GAME_PATH.namebase
93+
GAME_NAME = GAME_PATH.name
9494

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

244244
# If no file was found, return an empty list
245-
if not path.isfile():
245+
if not path.is_file():
246246
return
247247

248248
# Import this here to fix cyclic imports

addons/source-python/packages/source-python/core/command/docs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def _prepare_generated_source_python_file(file_path):
195195
"""
196196
new_name = file_path.parent / file_path.basename().replace(
197197
'source-python.', '')
198-
if new_name.isfile():
198+
if new_name.is_file():
199199
file_path.remove()
200200
return
201201

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

450450

451451
def is_plugin(package):
452452
"""Return True if the given package name is a plugin."""
453453
return package in map(
454-
lambda path: str(path.namebase), PLUGIN_PATH.dirs())
454+
lambda path: str(path.name), PLUGIN_PATH.dirs())
455455

456456

457457
# =============================================================================

addons/source-python/packages/source-python/core/update.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _clean_update_dir():
168168
"""Clear or create the update directory."""
169169
if UPDATE_PATH.exists():
170170
for f in UPDATE_PATH.listdir():
171-
if f.isfile():
171+
if f.is_file():
172172
f.remove()
173173
else:
174174
f.rmtree()
@@ -200,12 +200,12 @@ def _apply_update_stage1():
200200
_apply_update_stage1_linux()
201201

202202
# Apply latest data update
203-
if not DATA_ZIP_FILE.isfile():
203+
if not DATA_ZIP_FILE.is_file():
204204
return
205205

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

208-
if UPDATE_SP_DATA_PATH.isdir():
208+
if UPDATE_SP_DATA_PATH.is_dir():
209209
update_logger.log_debug(f'Removing {UPDATE_SP_DATA_PATH} ...')
210210
UPDATE_SP_DATA_PATH.rmtree()
211211

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

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

291291
return DATA_ZIP_FILE.read_hexhash('md5') != get_latest_data_checksum(timeout)

addons/source-python/packages/source-python/entities/entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
# =============================================================================
4141
if SP_PACKAGES_PATH.joinpath(
4242
'entities', 'engines', SOURCE_ENGINE, GAME_NAME + '.py'
43-
).isfile():
43+
).is_file():
4444

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

5353
elif SP_PACKAGES_PATH.joinpath(
5454
'entities', 'engines', SOURCE_ENGINE, '__init__.py'
55-
).isfile():
55+
).is_file():
5656

5757
# Import the engine-specific 'Entity' class
5858
Entity = entities._base.Entity = import_module(

addons/source-python/packages/source-python/events/resource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def fullpath(self):
8181
def write(self):
8282
"""Write the .res file to disk."""
8383
# Does the director for the .res file exist?
84-
if not self.fullpath.parent.isdir():
84+
if not self.fullpath.parent.is_dir():
8585

8686
# Create the directory
8787
self.fullpath.parent.makedirs()

addons/source-python/packages/source-python/loggers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def __init__(
398398
log_path = LOG_PATH / filepath + '.log'
399399

400400
# Does the parent directory exist?
401-
if not log_path.parent.isdir():
401+
if not log_path.parent.is_dir():
402402

403403
# Create the parent directory
404404
log_path.parent.makedirs()

addons/source-python/packages/source-python/players/entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# =============================================================================
3232
if SP_PACKAGES_PATH.joinpath(
3333
'players', 'engines', SOURCE_ENGINE, GAME_NAME + '.py'
34-
).isfile():
34+
).is_file():
3535

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

4444
elif SP_PACKAGES_PATH.joinpath(
4545
'players', 'engines', SOURCE_ENGINE, '__init__.py'
46-
).isfile():
46+
).is_file():
4747

4848
# Import the engine-specific 'Player' class
4949
Player = players._base.Player = import_module(

addons/source-python/packages/source-python/plugins/manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def plugins(self):
131131
:rtype: generator
132132
"""
133133
for path in self.plugins_directory.dirs():
134-
plugin_name = path.namebase
134+
plugin_name = path.name
135135
if not self.is_valid_plugin_name(plugin_name):
136136
continue
137137

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

178178
plugin = self._create_plugin_instance(plugin_name)
179-
if not plugin.file_path.isfile():
179+
if not plugin.file_path.is_file():
180180
raise PluginFileNotFoundError(
181181
'File {} does not exist.'.format(plugin.file_path))
182182

@@ -284,7 +284,7 @@ def plugin_exists(self, plugin_name):
284284
The plugin to check.
285285
:rtype: bool
286286
"""
287-
return self.get_plugin_file_path(plugin_name).isfile()
287+
return self.get_plugin_file_path(plugin_name).is_file()
288288

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

359359
info_file = self.get_plugin_directory(plugin_name) / 'info.ini'
360-
if not info_file.isfile():
360+
if not info_file.is_file():
361361
# Just return an "empty" PluginInfo instance. We don't have more
362362
# information.
363363
return PluginInfo(plugin_name)

addons/source-python/packages/source-python/settings/storage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
_STORAGE_PATH = SP_DATA_PATH / 'settings' / 'users.db'
2424

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

2828
# Create the ../data/source-python/settings/ directory
2929
_STORAGE_PATH.parent.mkdir()

addons/source-python/packages/source-python/translations/strings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,21 @@ def __init__(self, infile, encoding='utf_8'):
6161
self._encoding = encoding
6262

6363
# Does the file exist?
64-
if not self._mainfile.isfile():
64+
if not self._mainfile.is_file():
6565

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

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

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

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

8080
# Create the server specific file
8181
self._create_server_file()

addons/source-python/packages/source-python/weapons/entity.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# =============================================================================
3232
if SP_PACKAGES_PATH.joinpath(
3333
'weapons', 'engines', SOURCE_ENGINE, GAME_NAME + '.py'
34-
).isfile():
34+
).is_file():
3535

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

4444
elif SP_PACKAGES_PATH.joinpath(
4545
'weapons', 'engines', SOURCE_ENGINE, '__init__.py'
46-
).isfile():
46+
).is_file():
4747

4848
# Import the engine-specific 'Weapon' class
4949
Weapon = weapons._base.Weapon = import_module(

addons/source-python/packages/source-python/weapons/manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def tags(self):
168168
return self._tags
169169

170170
# Does the current game have an ini file?
171-
if _gamepath.isfile():
171+
if _gamepath.is_file():
172172

173173
# Get the _WeaponManager instance
174174
weapon_manager = _WeaponManager()

0 commit comments

Comments
 (0)