@@ -54,11 +54,7 @@ def onerror(function, path, excinfo):
54
54
def getFileProperties (fname ):
55
55
"""Read all properties of the given file return them as a dictionary."""
56
56
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' )
62
58
props = {'FixedFileInfo' : None , 'StringFileInfo' : None , 'FileVersion' : None }
63
59
64
60
try :
@@ -83,16 +79,11 @@ def getFileProperties(fname):
83
79
def get_special_folder_path (path_name ):
84
80
"""Return special folder path."""
85
81
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" )
96
87
97
88
def get_winpython_start_menu_folder (current = True ):
98
89
"""Return WinPython Start menu shortcuts folder."""
@@ -337,7 +328,7 @@ def buildflit_wininst(root, python_exe=None, copy_to=None, verbose=False):
337
328
break
338
329
else :
339
330
raise RuntimeError (f"Build failed: not a pure Python package? { distdir } " )
340
-
331
+
341
332
src_fname = distdir / distname
342
333
if copy_to :
343
334
dst_fname = Path (copy_to ) / distname
0 commit comments