Skip to content

Commit 092a33c

Browse files
committed
Fix documentation
1 parent 3cfe784 commit 092a33c

File tree

4 files changed

+19
-42
lines changed

4 files changed

+19
-42
lines changed

addons/source-python/docs/source-python/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@
302302
# =============================================================================
303303
# >> INTERSPHINX
304304
# =============================================================================
305-
intersphinx_mapping = {'python': ('https://docs.python.org/3.%3Cspan%20class="x x-first x-last">6', None)}
305+
intersphinx_mapping = {'python': ('https://docs.python.org/3.%3Cspan%20class="x x-first x-last">13', None)}
306306

307307

308308
# =============================================================================

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

Lines changed: 16 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -109,38 +109,27 @@ def create(self, author, project_name=None, version='1'):
109109
self.validate_package()
110110
self.project_dir.mkdir()
111111

112-
from sphinx.quickstart import main
113-
114-
argv = [
115-
'', # Will be skipped.
116-
'-q', # Don't start the interactive mode
117-
]
112+
from sphinx.cmd.quickstart import main
118113

119114
if project_name is None:
120115
project_name = self.package_dir.name
121116

122-
argv.append('-p {0}'.format(project_name))
123-
argv.append('-a {0}'.format(author))
124-
argv.append('-v {0}'.format(version))
125-
126-
argv.extend([
127-
str(self.project_dir),
128-
'--sep', # Separate source and build directory
129-
'--ext-autodoc', # Enable autodoc
117+
argv = [
118+
'-q', # Don't start the interactive mode
119+
f'-p {project_name}',
120+
f'-a {author}',
121+
f'-v {version}',
122+
self.project_dir,
123+
'--sep', # Separate source and build directory
124+
'--ext-autodoc', # Enable autodoc
130125
'--no-makefile',
131126
'--no-batchfile'
132-
])
127+
]
133128

134-
# Hacky, but required, because sphinx is reading sys.argv even if you
135-
# pass a list to main()
136-
old_argv = sys.argv
137-
sys.argv = argv
138129
try:
139-
main(sys.argv)
130+
main(argv)
140131
except:
141132
raise SphinxError
142-
finally:
143-
sys.argv = old_argv
144133

145134
def generate_project_files(self, sub_dir=''):
146135
"""Generate the project files (`*.rst` files).
@@ -155,25 +144,19 @@ def generate_project_files(self, sub_dir=''):
155144
"""
156145
self.validate_project_and_package()
157146

158-
from sphinx.apidoc import main
147+
from sphinx.ext.apidoc._cli import main
148+
159149
argv = [
160-
'', # Will be skipped.
161150
'-e', # Separate pages/files for every module
162151
'-o',
163152
str(self.project_source_dir / sub_dir),
164153
str(self.package_dir), # Package to document
165154
]
166155

167-
# Hacky, but required, because sphinx is reading sys.argv even if you
168-
# pass a list to main()
169-
old_argv = sys.argv
170-
sys.argv = argv
171156
try:
172-
main(sys.argv)
157+
main(argv)
173158
except:
174159
raise SphinxError
175-
finally:
176-
sys.argv = old_argv
177160

178161
def build(self, clean=False):
179162
"""Build the Sphinx project.
@@ -193,24 +176,18 @@ def build(self, clean=False):
193176
if add_to_path:
194177
sys.path.append(str(self.package_dir.parent))
195178

196-
from sphinx import main
179+
from sphinx.cmd.build import main
197180
argv = [
198-
'', # Will be skipped.
199181
str(self.project_source_dir),
200182
str(self.project_build_dir),
201183
]
202184

203-
# Hacky, but required, because sphinx is reading sys.argv even if you
204-
# pass a list to main()
205-
old_argv = sys.argv
206-
sys.argv = argv
207185
try:
208-
main(sys.argv)
186+
main(argv)
209187
except SystemExit as e:
210188
if e.code != 0:
211189
raise SphinxError
212190
finally:
213-
sys.argv = old_argv
214191
if add_to_path:
215192
sys.path.remove(str(self.package_dir.parent))
216193

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ 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.name), CUSTOM_PACKAGES_PATH.listdir())
448+
lambda path: str(path.name), CUSTOM_PACKAGES_PATH.iterdir())
449449

450450

451451
def is_plugin(package):

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ def get_download_url(https://github.com/game=SOURCE_ENGINE_BRANCH,%20timeout=DEFAULT_TIMEOUT):
167167
def _clean_update_dir():
168168
"""Clear or create the update directory."""
169169
if UPDATE_PATH.exists():
170-
for f in UPDATE_PATH.listdir():
170+
for f in UPDATE_PATH.iterdir():
171171
if f.is_file():
172172
f.remove()
173173
else:

0 commit comments

Comments
 (0)