Update shebang to use env python3

This commit is contained in:
Théophile Diot 2024-01-05 11:49:04 +00:00
parent c4bcaba03f
commit 0ec97a77c5
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06
48 changed files with 55 additions and 75 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import getenv
from time import sleep

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from abc import abstractmethod
from os import getenv

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from typing import Any, Dict, List
from docker import DockerClient

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from time import sleep
from traceback import format_exc

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from time import sleep
from traceback import format_exc

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import _exit, getenv, sep
from os.path import join

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from typing import Literal, Optional, Union
from requests import request

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from argparse import ArgumentParser
from os import _exit, getenv, sep

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from contextlib import suppress
from ipaddress import ip_address, ip_network

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import _exit, getenv, sep
from os.path import join

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import _exit, getenv, sep
from os.path import join

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import getenv, sep
from pathlib import Path

View file

@ -1,11 +1,10 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import getenv, sep
from os.path import join, normpath
from pathlib import Path
from sys import exit as sys_exit, path as sys_path
from traceback import format_exc
from typing import Optional
from base64 import b64decode
for deps_path in [
@ -103,7 +102,7 @@ try:
cert_data = b64decode(getenv("CUSTOM_SSL_CERT_DATA", ""))
key_data = b64decode(getenv("CUSTOM_SSL_KEY_DATA", ""))
for file, data in [("cert.pem", cert_data), ("key.pem", key_data)]:
for file, data in (("cert.pem", cert_data), ("key.pem", key_data)):
if data != b"":
file_path = Path(sep, "var", "tmp", "bunkerweb", "customcert", first_server, file)
file_path.parent.mkdir(parents=True, exist_ok=True)
@ -140,7 +139,7 @@ try:
cert_data = b64decode(getenv(f"{first_server}_CUSTOM_SSL_CERT_DATA", ""))
key_data = b64decode(getenv(f"{first_server}_CUSTOM_SSL_KEY_DATA", ""))
for file, data in [("cert.pem", cert_data), ("key.pem", key_data)]:
for file, data in (("cert.pem", cert_data), ("key.pem", key_data)):
if data != b"":
file_path = Path(sep, "var", "tmp", "bunkerweb", "customcert", first_server, file)
file_path.parent.mkdir(parents=True, exist_ok=True)

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from contextlib import suppress
from ipaddress import ip_address, ip_network

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from hashlib import sha256
from io import BytesIO

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from datetime import date
from gzip import decompress

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from datetime import date
from gzip import decompress

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import getenv, sep
from os.path import join

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import getenv, sep
from os.path import join

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from io import BytesIO
from os import getenv, sep

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import _exit, environ, getenv, sep
from os.path import join

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import _exit, environ, getenv, sep
from os.path import join

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from json import dumps
from os import getenv, sep

View file

@ -1,6 +1,6 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import _exit, getenv, sep
from os import getenv, sep
from os.path import join
from pathlib import Path
from subprocess import DEVNULL, run

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import getenv, sep
from os.path import basename, join

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from contextlib import suppress
from ipaddress import ip_address, ip_network

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from datetime import timedelta
from os import getenv, sep

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from contextlib import suppress
from ipaddress import ip_address, ip_network

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from contextlib import contextmanager, suppress
from copy import deepcopy

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from sqlalchemy import (
Boolean,

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from glob import glob
from hashlib import sha256

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from glob import glob
from importlib import import_module

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from argparse import ArgumentParser
from glob import glob

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from argparse import ArgumentParser
from os import R_OK, X_OK, access, environ, getenv, sep

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import getegid, geteuid
from pathlib import Path

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from io import BytesIO
from os import getenv, sep

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from glob import glob
from json import JSONDecodeError, loads

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from contextlib import suppress
from datetime import datetime

View file

@ -50,7 +50,6 @@ WORKDIR /usr/share/bunkerweb
# Add scheduler user, drop bwcli, install runtime dependencies, create data folders and set permissions
RUN apk add --no-cache bash libgcc libstdc++ libpq openssl libmagic && \
ln -s /usr/local/bin/python3 /usr/bin/python3 && \
addgroup -g 101 scheduler && \
adduser -h /var/cache/nginx -g scheduler -s /bin/sh -G scheduler -D -H -u 101 scheduler && \
cp helpers/bwcli /usr/bin/ && \

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from copy import deepcopy
from functools import partial

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from argparse import ArgumentParser
from copy import deepcopy
@ -6,16 +6,7 @@ from glob import glob
from hashlib import sha256
from io import BytesIO
from json import load as json_load
from os import (
_exit,
chmod,
environ,
getenv,
getpid,
listdir,
sep,
walk,
)
from os import _exit, chmod, environ, getenv, getpid, listdir, sep, walk
from os.path import basename, dirname, join, normpath
from pathlib import Path
from shutil import copy, rmtree
@ -322,11 +313,7 @@ if __name__ == "__main__":
content = Path(join(root, file)).read_text(encoding="utf-8")
custom_conf = {
"value": content,
"exploded": (
f"{path_exploded.pop()}" if path_exploded[-1] not in root_dirs else None,
path_exploded[-1],
file.replace(".conf", ""),
),
"exploded": (path_exploded.pop() if path_exploded[-1] not in root_dirs else None, path_exploded[-1], file.replace(".conf", "")),
}
saving = True
@ -674,7 +661,6 @@ if __name__ == "__main__":
env = db.get_config()
env["DATABASE_URI"] = db.database_uri
except:
logger.error(
f"Exception while executing scheduler : {format_exc()}",

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from contextlib import suppress
from os import _exit, getenv, listdir, sep, urandom
@ -1132,11 +1132,11 @@ def plugins():
except (TarError, OSError) as e:
errors += 1
error = 1
flash(f"{e}", "error")
flash(str(e), "error")
except Exception as e:
errors += 1
error = 1
flash(f"{e}", "error")
flash(str(e), "error")
finally:
if error != 1:
flash(f"Successfully created plugin: <b><i>{folder_name}</i></b>")

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from copy import deepcopy
from os import sep

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from glob import glob
from os import listdir, replace, sep, walk
@ -62,11 +62,7 @@ class ConfigFiles:
custom_configs.append(
{
"value": f.read(),
"exploded": (
f"{path_exploded.pop()}" if path_exploded[-1] not in root_dirs else None,
path_exploded[-1],
file.replace(".conf", ""),
),
"exploded": (path_exploded.pop() if path_exploded[-1] not in root_dirs else None, path_exploded[-1], file.replace(".conf", "")),
}
)

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from os import sep
from os.path import join

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from werkzeug.middleware.proxy_fix import ProxyFix

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from typing import Optional

View file

@ -1,4 +1,4 @@
#!/usr/bin/python3
#!/usr/bin/env python3
from base64 import b64encode
from io import BytesIO