9
9
import stat
10
10
from os .path import abspath , basename , dirname , exists , isabs
11
11
from os .path import join as pjoin
12
+ from pathlib import Path
12
13
from subprocess import check_call
13
14
from typing import Iterable
14
15
@@ -237,7 +238,7 @@ def _resolve_rpath_tokens(rpath: str, lib_base_dir: str) -> str:
237
238
238
239
def _path_is_script (path : str ) -> bool :
239
240
# Looks something like "uWSGI-2.0.21.data/scripts/uwsgi"
240
- components = path . split ( "/" )
241
+ components = Path ( path ). parts
241
242
return (
242
243
len (components ) == 3
243
244
and components [0 ].endswith (".data" )
@@ -265,7 +266,7 @@ def _replace_elf_script_with_shim(package_name: str, orig_path: str) -> str:
265
266
new_path = os .path .join (scripts_dir , os .path .basename (orig_path ))
266
267
os .rename (orig_path , new_path )
267
268
268
- with open (orig_path , "w" ) as f :
269
+ with open (orig_path , "w" , newline = " \n " ) as f :
269
270
f .write (_script_shim (new_path ))
270
271
os .chmod (orig_path , os .stat (new_path ).st_mode )
271
272
@@ -286,5 +287,5 @@ def _script_shim(binary_path: str) -> str:
286
287
sys.argv,
287
288
)
288
289
""" .format (
289
- binary_path = binary_path ,
290
+ binary_path = Path ( binary_path ). as_posix () ,
290
291
)
0 commit comments