8000 remove what is useless · winpython/winpython@63f0e95 · GitHub
[go: up one dir, main page]

Skip to content

Commit 63f0e95

Browse files
committed
remove what is useless
1 parent 0ac8614 commit 63f0e95

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

winpython/utils.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,7 @@ def onerror(function, path, excinfo):
5454
def getFileProperties(fname):
5555
"""Read all properties of the given file return them as a dictionary."""
5656
import win32api
57-
prop_names = (
58-
'Comments', 'InternalName', 'ProductName', 'CompanyName', 'LegalCopyright',
59-
'ProductVersion', 'FileDescription', 'LegalTrademarks', 'PrivateBuild',
60-
'FileVersion', 'OriginalFilename', 'SpecialBuild'
61-
)
57+
prop_names = ('ProductName', 'ProductVersion', 'FileDescription', 'FileVersion')
6258
props = {'FixedFileInfo': None, 'StringFileInfo': None, 'FileVersion': None}
6359

6460
try:
@@ -83,16 +79,11 @@ def getFileProperties(fname):
8379
def get_special_folder_path(path_name):
8480
"""Return special folder path."""
8581
from win32com.shell import shell, shellcon
86-
for maybe in """
87-
CSIDL_COMMON_STARTMENU CSIDL_STARTMENU CSIDL_COMMON_APPDATA
88-
CSIDL_LOCAL_APPDATA CSIDL_APPDATA CSIDL_COMMON_DESKTOPDIRECTORY
89-
CSIDL_DESKTOPDIRECTORY CSIDL_COMMON_STARTUP CSIDL_STARTUP
90-
CSIDL_COMMON_PROGRAMS CSIDL_PROGRAMS CSIDL_PROGRAM_FILES_COMMON
91-
CSIDL_PROGRAM_FILES CSIDL_FONTS""".split():
92-
if maybe == path_name:
93-
csidl = getattr(shellcon, maybe)
94-
return shell.SHGetSpecialFolderPath(0, csidl, False)
95-
raise ValueError(f"{path_name} is an unknown path ID")
82+
try:
83+
csidl = getattr(shellcon, path_name)
84+
return shell.SHGetSpecialFolderPath(0, csidl, False)
85+
except OSError:
86+
print(f"{path_name} is an unknown path ID")
9687

9788
def get_winpython_start_menu_folder(current=True):
9889
"""Return WinPython Start menu shortcuts folder."""
@@ -337,7 +328,7 @@ def buildflit_wininst(root, python_exe=None, copy_to=None, verbose=False):
337328
break
338329
else:
339330
raise RuntimeError(f"Build failed: not a pure Python package? {distdir}")
340-
331+
341332
src_fname = distdir / distname
342333
if copy_to:
343334
dst_fname = Path(copy_to) / distname

0 commit comments

Comments
 (0)
0