diff options
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/msi/lib/lib_files.wxs | 6 | ||||
-rw-r--r-- | Tools/parser/unparse.py | 39 | ||||
-rwxr-xr-x | Tools/scripts/pyvenv | 6 |
3 files changed, 45 insertions, 6 deletions
diff --git a/Tools/msi/lib/lib_files.wxs b/Tools/msi/lib/lib_files.wxs index fa79a8d..804ab01 100644 --- a/Tools/msi/lib/lib_files.wxs +++ b/Tools/msi/lib/lib_files.wxs @@ -64,16 +64,10 @@ <RegistryValue Key="PythonPath" Type="string" Value="[Lib];[DLLs]" /> </RegistryKey> </Component> - <Component Id="Lib_site_packages_README" Directory="Lib_site_packages" Guid="*"> - <File Id="Lib_site_packages_README" Name="README.txt" Source="!(bindpath.src)Lib\site-packages\README" KeyPath="yes" /> - </Component> <Component Id="Lib2to3_pickle_remove" Directory="Lib_lib2to3" Guid="$(var.RemoveLib2to3PickleComponentGuid)"> <RemoveFile Id="Lib2to3_pickle_remove_files" Name="*.pickle" On="uninstall" /> <RemoveFolder Id="Lib2to3_pickle_remove_folder" On="uninstall" /> </Component> </ComponentGroup> - <DirectoryRef Id="Lib"> - <Directory Id="Lib_site_packages" Name="site-packages" /> - </DirectoryRef> </Fragment> </Wix> diff --git a/Tools/parser/unparse.py b/Tools/parser/unparse.py index c828577..9972797 100644 --- a/Tools/parser/unparse.py +++ b/Tools/parser/unparse.py @@ -322,6 +322,45 @@ class Unparser: def _Str(self, tree): self.write(repr(tree.s)) + def _JoinedStr(self, t): + self.write("f") + string = io.StringIO() + self._fstring_JoinedStr(t, string.write) + self.write(repr(string.getvalue())) + + def _FormattedValue(self, t): + self.write("f") + string = io.StringIO() + self._fstring_FormattedValue(t, string.write) + self.write(repr(string.getvalue())) + + def _fstring_JoinedStr(self, t, write): + for value in t.values: + meth = getattr(self, "_fstring_" + type(value).__name__) + meth(value, write) + + def _fstring_Str(self, t, write): + value = t.s.replace("{", "{{").replace("}", "}}") + write(value) + + def _fstring_FormattedValue(self, t, write): + write("{") + expr = io.StringIO() + Unparser(t.value, expr) + expr = expr.getvalue().rstrip("\n") + if expr.startswith("{"): + write(" ") # Separate pair of opening brackets as "{ {" + write(expr) + if t.conversion != -1: + conversion = chr(t.conversion) + assert conversion in "sra" + write(f"!{conversion}") + if t.format_spec: + write(":") + meth = getattr(self, "_fstring_" + type(t.format_spec).__name__) + meth(t.format_spec, write) + write("}") + def _Name(self, t): self.write(t.id) diff --git a/Tools/scripts/pyvenv b/Tools/scripts/pyvenv index 978d691..1fb42c6 100755 --- a/Tools/scripts/pyvenv +++ b/Tools/scripts/pyvenv @@ -1,6 +1,12 @@ #!/usr/bin/env python3 if __name__ == '__main__': import sys + import pathlib + + executable = pathlib.Path(sys.executable or 'python3').name + print('WARNING: the pyenv script is deprecated in favour of ' + f'`{executable} -m venv`', file=sys.stderr) + rc = 1 try: import venv |