This commit is contained in:
Zsolt Ero
2024-01-03 22:12:57 +01:00
parent 9059c27707
commit b3ce2bd9dd
4 changed files with 10 additions and 10 deletions

View File

@@ -46,7 +46,7 @@ def download_tileset(area: str, version: str, list_versions: bool, runs_dir: Pat
print('running download_tileset') print('running download_tileset')
if area not in {'planet', 'monaco'}: if area not in {'planet', 'monaco'}:
sys.exit('Please specify area: "planet" or "monaco"') sys.exit(' please specify area: "planet" or "monaco"')
r = requests.get(f'https://{area}.openfreemap.com/dirs.txt') r = requests.get(f'https://{area}.openfreemap.com/dirs.txt')
r.raise_for_status() r.raise_for_status()
@@ -114,7 +114,7 @@ def mount():
clean_up_mounts(MNT_DIR) clean_up_mounts(MNT_DIR)
create_fstab() create_fstab()
print('Running mount -a') print(' running mount -a')
subprocess.run(['mount', '-a'], check=True) subprocess.run(['mount', '-a'], check=True)
clean_up_mounts(MNT_DIR) clean_up_mounts(MNT_DIR)

View File

@@ -9,19 +9,19 @@ import requests
def assert_sudo(): def assert_sudo():
if os.geteuid() != 0: if os.geteuid() != 0:
sys.exit('Needs sudo') sys.exit(' needs sudo')
def assert_linux(): def assert_linux():
if not Path('/etc/fstab').exists(): if not Path('/etc/fstab').exists():
sys.exit('Needs to be run on Linux') sys.exit(' needs to be run on Linux')
def assert_single_process(): def assert_single_process():
p = subprocess.run(['pgrep', '-fl', sys.argv[0]], capture_output=True, text=True) p = subprocess.run(['pgrep', '-fl', sys.argv[0]], capture_output=True, text=True)
lines = [l for l in p.stdout.splitlines() if 'python' in l] lines = [l for l in p.stdout.splitlines() if 'python' in l]
if len(lines) >= 2: if len(lines) >= 2:
sys.exit('Detected multiple processes, terminating') sys.exit(' detected multiple processes, terminating')
def download_if_size_differs(url: str, local_file: Path) -> bool: def download_if_size_differs(url: str, local_file: Path) -> bool:

View File

@@ -24,7 +24,7 @@ def cli(mbtiles_path: Path, dir_path: Path):
""" """
if dir_path.exists() and any(dir_path.iterdir()): if dir_path.exists() and any(dir_path.iterdir()):
sys.exit('Dir not empty') sys.exit(' dir not empty')
dir_path.mkdir(exist_ok=True) dir_path.mkdir(exist_ok=True)

View File

@@ -33,7 +33,7 @@ def cli(btrfs_img: Path):
""" """
if os.geteuid() != 0: if os.geteuid() != 0:
sys.exit('Needs sudo') sys.exit(' needs sudo')
current_dir = Path.cwd() current_dir = Path.cwd()