@@ -63,13 +63,11 @@ def onerror(function, path, excinfo):
63
63
raise
64
64
65
65
66
- #==============================================================================
67
- # https://stackoverflow.com/questions/580924/how-to-access-a-files-properties-on-windows
68
66
def getFileProperties (fname ):
69
- #==============================================================================
70
67
"""
71
68
Read all properties of the given file return them as a dictionary.
72
69
"""
70
+ # from https://stackoverflow.com/questions/580924/how-to-access-a-files-properties-on-windows
73
71
import win32api
74
72
propNames = ('Comments' , 'InternalName' , 'ProductName' ,
75
73
'CompanyName' , 'LegalCopyright' , 'ProductVersion' ,
@@ -104,9 +102,6 @@ def getFileProperties(fname):
104
102
pass
105
103
106
104
return props
107
- # =============================================================================
108
- # Shortcuts, start menu
109
- # =============================================================================
110
105
111
106
112
107
def get_special_folder_path (path_name ):
@@ -215,11 +210,6 @@ def create_shortcut(
215
210
pass
216
211
217
212
218
- # =============================================================================
219
- # Misc.
220
- # =============================================================================
221
-
222
-
223
213
def print_box (text ):
224
214
"""Print text in a box"""
225
215
line0 = "+" + ("-" * (len (text ) + 2 )) + "+"
@@ -237,11 +227,6 @@ def is_python_distribution(path):
237
227
return has_exec and has_site
238
228
239
229
240
- # =============================================================================
241
- # Shell, Python queries
242
- # =============================================================================
243
-
244
-
245
230
def decode_fs_string (string ):
246
231
"""Convert string from file system charset to unicode"""
247
232
charset = sys .getfilesystemencoding ()
@@ -365,13 +350,10 @@ def get_python_long_version(path):
365
350
return ver
366
351
367
352
368
- # =============================================================================
369
- # Patch chebang line (courtesy of Christoph Gohlke)
370
- # =============================================================================
371
353
def patch_shebang_line (
372
354
fname , pad = b' ' , to_movable = True , targetdir = ""
373
355
):
374
- """Remove absolute path to python.exe in shebang lines, or re-add it"""
356
+ """Remove absolute path to python.exe in shebang lines in binary files , or re-add it"""
375
357
376
358
import re
377
359
import sys
@@ -425,9 +407,6 @@ def patch_shebang_line(
425
407
print ("failed to patch" , fname )
426
408
427
409
428
- # =============================================================================
429
- # Patch shebang line in .py files
430
- # =============================================================================
431
410
def patch_shebang_line_py (
432
411
fname , to_movable = True , targetdir = ""
433
412
):
@@ -455,9 +434,6 @@ def patch_shebang_line_py(
455
434
print (line , end = '' )
456
435
457
436
458
- # =============================================================================
459
- # Guess encoding (shall rather be utf-8 per default)
460
- # =============================================================================
461
437
def guess_encoding (csv_file ):
462
438
"""guess the encoding of the given file"""
463
439
# UTF_8_BOM = "\xEF\xBB\xBF"
@@ -474,9 +450,7 @@ def guess_encoding(csv_file):
474
450
except :
475
451
return [locale .getdefaultlocale ()[1 ], "utf-8" ]
476
452
477
- # =============================================================================
478
- # Patch sourcefile (instead of forking packages)
479
- # =============================================================================
453
+
480
454
def patch_sourcefile (
481
455
fname , in_text , out_text , silent_mode = False
482
456
):
@@ -502,9 +476,6 @@ def patch_sourcefile(
502
476
fh .write (new_content )
503
477
504
478
505
- # =============================================================================
506
- # Patch sourcelines (instead of forking packages)
507
- # =============================================================================
508
479
def patch_sourcelines (
509
480
fname ,
510
481
in_line_start ,
@@ -563,9 +534,6 @@ def patch_sourcelines(
563
534
)
564
535
565
536
566
- # =============================================================================
567
- # Extract functions
568
- # =============================================================================
569
537
def _create_temp_dir ():
570
538
"""Create a temporary directory and remove it at exit"""
571
539
tmpdir = tempfile .mkdtemp (prefix = 'wppm_' )
0 commit comments