Update .gitignore and .vscode/settings.json when generating pyi files.
Also check in some missing pyis.
This commit is contained in:
+41
-4
@@ -13,12 +13,8 @@ ehthumbs_vista.db
|
|||||||
# Python related files.
|
# Python related files.
|
||||||
*.pyc
|
*.pyc
|
||||||
*.pyo
|
*.pyo
|
||||||
*.pyi
|
|
||||||
*.egg-info
|
*.egg-info
|
||||||
|
|
||||||
!/renpy/cslots.pyi
|
|
||||||
!/renpy/astsupport.pyi
|
|
||||||
|
|
||||||
# Editor/tool files.
|
# Editor/tool files.
|
||||||
*~
|
*~
|
||||||
*.bak
|
*.bak
|
||||||
@@ -137,3 +133,44 @@ CubismSdkForNative-4-*.zip
|
|||||||
/cg
|
/cg
|
||||||
/.vscode/launch.json
|
/.vscode/launch.json
|
||||||
/.vscode/tasks.json
|
/.vscode/tasks.json
|
||||||
|
|
||||||
|
|
||||||
|
# Pyi Files (generated by scripts/generate_pyi.py)
|
||||||
|
renpy/audio/filter.pyi
|
||||||
|
renpy/audio/renpysound.pyi
|
||||||
|
renpy/display/accelerator.pyi
|
||||||
|
renpy/display/matrix.pyi
|
||||||
|
renpy/display/quaternion.pyi
|
||||||
|
renpy/display/render.pyi
|
||||||
|
renpy/encryption.pyi
|
||||||
|
renpy/gl2/gl2draw.pyi
|
||||||
|
renpy/gl2/gl2mesh.pyi
|
||||||
|
renpy/gl2/gl2mesh2.pyi
|
||||||
|
renpy/gl2/gl2mesh3.pyi
|
||||||
|
renpy/gl2/gl2model.pyi
|
||||||
|
renpy/gl2/gl2polygon.pyi
|
||||||
|
renpy/gl2/gl2shader.pyi
|
||||||
|
renpy/gl2/gl2texture.pyi
|
||||||
|
renpy/gl2/live2dmodel.pyi
|
||||||
|
renpy/lexersupport.pyi
|
||||||
|
renpy/pydict.pyi
|
||||||
|
renpy/style.pyi
|
||||||
|
renpy/style.pyi
|
||||||
|
renpy/styledata/style_activate_functions.pyi
|
||||||
|
renpy/styledata/style_functions.pyi
|
||||||
|
renpy/styledata/style_hover_functions.pyi
|
||||||
|
renpy/styledata/style_idle_functions.pyi
|
||||||
|
renpy/styledata/style_insensitive_functions.pyi
|
||||||
|
renpy/styledata/style_selected_activate_functions.pyi
|
||||||
|
renpy/styledata/style_selected_functions.pyi
|
||||||
|
renpy/styledata/style_selected_hover_functions.pyi
|
||||||
|
renpy/styledata/style_selected_idle_functions.pyi
|
||||||
|
renpy/styledata/style_selected_insensitive_functions.pyi
|
||||||
|
renpy/styledata/styleclass.pyi
|
||||||
|
renpy/styledata/stylesets.pyi
|
||||||
|
renpy/text/ftfont.pyi
|
||||||
|
renpy/text/hbfont.pyi
|
||||||
|
renpy/text/textsupport.pyi
|
||||||
|
renpy/text/texwrap.pyi
|
||||||
|
renpy/uguu/gl.pyi
|
||||||
|
renpy/uguu/uguu.pyi
|
||||||
|
|||||||
Vendored
+51
-15
@@ -1,16 +1,16 @@
|
|||||||
{
|
{
|
||||||
"files.watcherExclude": {
|
"files.watcherExclude": {
|
||||||
"**/renpy/0old/**" : true,
|
"**/renpy/0old/**": true,
|
||||||
"**/renpy/atom/**" : true,
|
"**/renpy/atom/**": true,
|
||||||
"**/renpy/cubism/**" : true,
|
"**/renpy/cubism/**": true,
|
||||||
"**/renpy/dists/**" : true,
|
"**/renpy/dists/**": true,
|
||||||
"**/renpy/dl/**" : true,
|
"**/renpy/dl/**": true,
|
||||||
"**/renpy/doc/**" : true,
|
"**/renpy/doc/**": true,
|
||||||
"**/renpy/doc-web/**" : true,
|
"**/renpy/doc-web/**": true,
|
||||||
"**/renpy/jedit/**" : true,
|
"**/renpy/jedit/**": true,
|
||||||
"**/renpy/renpy*.app/**" : true,
|
"**/renpy/renpy*.app/**": true,
|
||||||
"**/renpy/tmp/**" : true,
|
"**/renpy/tmp/**": true,
|
||||||
"**/renpy/web/**" : true,
|
"**/renpy/web/**": true
|
||||||
},
|
},
|
||||||
"files.exclude": {
|
"files.exclude": {
|
||||||
"0old": true,
|
"0old": true,
|
||||||
@@ -41,9 +41,45 @@
|
|||||||
"web3": true,
|
"web3": true,
|
||||||
"**/*.rpa": true,
|
"**/*.rpa": true,
|
||||||
"**/*.rpymc": true,
|
"**/*.rpymc": true,
|
||||||
"**/cache/": true
|
"**/cache/": true,
|
||||||
|
"renpy/audio/filter.pyi": true,
|
||||||
|
"renpy/audio/renpysound.pyi": true,
|
||||||
|
"renpy/display/accelerator.pyi": true,
|
||||||
|
"renpy/display/matrix.pyi": true,
|
||||||
|
"renpy/display/quaternion.pyi": true,
|
||||||
|
"renpy/display/render.pyi": true,
|
||||||
|
"renpy/encryption.pyi": true,
|
||||||
|
"renpy/gl2/gl2draw.pyi": true,
|
||||||
|
"renpy/gl2/gl2mesh.pyi": true,
|
||||||
|
"renpy/gl2/gl2mesh2.pyi": true,
|
||||||
|
"renpy/gl2/gl2mesh3.pyi": true,
|
||||||
|
"renpy/gl2/gl2model.pyi": true,
|
||||||
|
"renpy/gl2/gl2polygon.pyi": true,
|
||||||
|
"renpy/gl2/gl2shader.pyi": true,
|
||||||
|
"renpy/gl2/gl2texture.pyi": true,
|
||||||
|
"renpy/gl2/live2dmodel.pyi": true,
|
||||||
|
"renpy/lexersupport.pyi": true,
|
||||||
|
"renpy/pydict.pyi": true,
|
||||||
|
"renpy/style.pyi": true,
|
||||||
|
"renpy/styledata/style_activate_functions.pyi": true,
|
||||||
|
"renpy/styledata/style_functions.pyi": true,
|
||||||
|
"renpy/styledata/style_hover_functions.pyi": true,
|
||||||
|
"renpy/styledata/style_idle_functions.pyi": true,
|
||||||
|
"renpy/styledata/style_insensitive_functions.pyi": true,
|
||||||
|
"renpy/styledata/style_selected_activate_functions.pyi": true,
|
||||||
|
"renpy/styledata/style_selected_functions.pyi": true,
|
||||||
|
"renpy/styledata/style_selected_hover_functions.pyi": true,
|
||||||
|
"renpy/styledata/style_selected_idle_functions.pyi": true,
|
||||||
|
"renpy/styledata/style_selected_insensitive_functions.pyi": true,
|
||||||
|
"renpy/styledata/styleclass.pyi": true,
|
||||||
|
"renpy/styledata/stylesets.pyi": true,
|
||||||
|
"renpy/text/ftfont.pyi": true,
|
||||||
|
"renpy/text/hbfont.pyi": true,
|
||||||
|
"renpy/text/textsupport.pyi": true,
|
||||||
|
"renpy/text/texwrap.pyi": true,
|
||||||
|
"renpy/uguu/gl.pyi": true,
|
||||||
|
"renpy/uguu/uguu.pyi": true
|
||||||
},
|
},
|
||||||
|
|
||||||
"python.languageServer": "Pylance",
|
"python.languageServer": "Pylance",
|
||||||
"python.analysis.typeCheckingMode": "basic",
|
"python.analysis.typeCheckingMode": "basic",
|
||||||
"python.analysis.diagnosticMode": "workspace",
|
"python.analysis.diagnosticMode": "workspace",
|
||||||
@@ -244,5 +280,5 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
@@ -11,6 +11,7 @@ import pathlib
|
|||||||
import textwrap
|
import textwrap
|
||||||
import inspect
|
import inspect
|
||||||
import types
|
import types
|
||||||
|
import json
|
||||||
|
|
||||||
ROOT = pathlib.Path(__file__).parent.parent.absolute()
|
ROOT = pathlib.Path(__file__).parent.parent.absolute()
|
||||||
sys.path.insert(0, str(ROOT))
|
sys.path.insert(0, str(ROOT))
|
||||||
@@ -28,6 +29,8 @@ class FakeScript:
|
|||||||
|
|
||||||
renpy.game.script = FakeScript()
|
renpy.game.script = FakeScript()
|
||||||
|
|
||||||
|
generated_files = [ ]
|
||||||
|
|
||||||
def python_signature(o):
|
def python_signature(o):
|
||||||
"""
|
"""
|
||||||
Given a callabale object, try to return a python-style type signature.
|
Given a callabale object, try to return a python-style type signature.
|
||||||
@@ -270,6 +273,8 @@ def generate_module(module : types.ModuleType, package : bool):
|
|||||||
|
|
||||||
generate_namespace(f, "", module)
|
generate_namespace(f, "", module)
|
||||||
|
|
||||||
|
generated_files.append(fn)
|
||||||
|
|
||||||
|
|
||||||
def is_extension(m : types.ModuleType):
|
def is_extension(m : types.ModuleType):
|
||||||
"""
|
"""
|
||||||
@@ -307,9 +312,49 @@ def should_generate(name, m : Any):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
def manage_gitignore():
|
||||||
|
|
||||||
|
gitignore = ROOT / ".gitignore"
|
||||||
|
|
||||||
|
old_lines = gitignore.read_text().split("\n")
|
||||||
|
new_lines = [ ]
|
||||||
|
|
||||||
|
for l in old_lines:
|
||||||
|
|
||||||
|
if l.endswith(".pyi"):
|
||||||
|
continue
|
||||||
|
|
||||||
|
new_lines.append(l)
|
||||||
|
|
||||||
|
if l == "# Pyi Files (generated by scripts/generate_pyi.py)":
|
||||||
|
new_lines.extend(generated_files)
|
||||||
|
|
||||||
|
gitignore.write_text("\n".join(new_lines))
|
||||||
|
|
||||||
|
def manage_vscode():
|
||||||
|
|
||||||
|
settings = ROOT / ".vscode" / "settings.json"
|
||||||
|
|
||||||
|
with open(settings) as f:
|
||||||
|
j = json.load(f)
|
||||||
|
|
||||||
|
files_exclude = j["files.exclude"]
|
||||||
|
|
||||||
|
files_exclude = { k : v for k, v in files_exclude.items() if not k.endswith(".pyi") }
|
||||||
|
|
||||||
|
for i in generated_files:
|
||||||
|
files_exclude[str(i)] = True
|
||||||
|
|
||||||
|
j["files.exclude"] = files_exclude
|
||||||
|
|
||||||
|
with open(settings, "w") as f:
|
||||||
|
json.dump(j, f, indent=4)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
|
global generated_files
|
||||||
|
|
||||||
packages = set()
|
packages = set()
|
||||||
|
|
||||||
for name in tuple(sys.modules):
|
for name in tuple(sys.modules):
|
||||||
@@ -323,6 +368,13 @@ def main():
|
|||||||
|
|
||||||
generate_module(v, k in packages)
|
generate_module(v, k in packages)
|
||||||
|
|
||||||
|
generated_files.sort()
|
||||||
|
generated_files = [ str(i.relative_to(ROOT)) for i in generated_files ]
|
||||||
|
generated_files = [ i for i in generated_files if i.startswith("renpy/") ]
|
||||||
|
|
||||||
|
manage_gitignore()
|
||||||
|
manage_vscode()
|
||||||
|
|
||||||
for fn in (ROOT / "scripts" / "pyi").glob("**/*.pyi"):
|
for fn in (ROOT / "scripts" / "pyi").glob("**/*.pyi"):
|
||||||
dfn = ROOT / "typings" / fn.relative_to(ROOT / "scripts" / "pyi")
|
dfn = ROOT / "typings" / fn.relative_to(ROOT / "scripts" / "pyi")
|
||||||
text = fn.read_text()
|
text = fn.read_text()
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
|
import android.apk
|
||||||
|
|
||||||
|
expansion = android.apk.APK
|
||||||
|
|
||||||
|
def init(): ...
|
||||||
|
|
||||||
|
activity : Any
|
||||||
|
|
||||||
|
def vibrate(s) -> None:...
|
||||||
|
|
||||||
|
def get_dpi() -> int: ...
|
||||||
|
|
||||||
|
def open_url(url : str) -> None: ...
|
||||||
|
|
||||||
|
def wakelock(active : bool) -> None: ...
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
def run_script(s) -> None: ...
|
||||||
|
def run_script_int(s) -> int: ...
|
||||||
|
def run_script_string(s) -> str: ...
|
||||||
|
|
||||||
|
def sleep(n : float) -> None: ...
|
||||||
|
|
||||||
|
def syncfs() -> None: ...
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
from typing import Any
|
||||||
|
|
||||||
|
def autoclass(name : str) -> Any: ...
|
||||||
Reference in New Issue
Block a user