mirror of
https://github.com/sotam0316/docker-py-revanced.git
synced 2026-04-25 03:48:37 +09:00
♻️ Chore
This commit is contained in:
@@ -109,6 +109,11 @@ class Downloader(object):
|
||||
:param file_name: name of the file after downloading
|
||||
"""
|
||||
logger.debug(f"Trying to download {name} from github")
|
||||
if self.config.dry_run:
|
||||
logger.debug(
|
||||
f"Skipping download of {file_name}. File already exists or dry running."
|
||||
)
|
||||
return
|
||||
repo_url = f"https://api.github.com/repos/{owner}/{name}/releases/latest"
|
||||
headers = {
|
||||
"Content-Type": "application/vnd.github.v3+json",
|
||||
@@ -129,7 +134,7 @@ class Downloader(object):
|
||||
|
||||
def download_revanced(self) -> None:
|
||||
"""Download Revanced and Extended Patches, Integration and CLI."""
|
||||
if os.path.exists("changelog.md"):
|
||||
if os.path.exists("changelog.md") and not self.config.dry_run:
|
||||
logger.debug("Deleting old changelog.md")
|
||||
os.remove("changelog.md")
|
||||
assets = [
|
||||
|
||||
@@ -35,7 +35,6 @@ class UptoDown(Downloader):
|
||||
extracted_version = version_item.find("span", {"class": "version"}).text
|
||||
if extracted_version == version:
|
||||
download_url = version_item["data-url"]
|
||||
print(f"data-url for version {version}: {download_url}")
|
||||
break
|
||||
if download_url is None:
|
||||
raise AppNotFound(f"Unable to get download url for {app}")
|
||||
|
||||
+3
-1
@@ -81,7 +81,6 @@ class Parser(object):
|
||||
:param is_experimental: Whether to enable experimental support
|
||||
:param output_prefix: Prefix to add to the output apks file name
|
||||
"""
|
||||
logger.debug(f"Sending request to revanced cli for building {app} revanced")
|
||||
cli = self.config.normal_cli_jar
|
||||
patches = self.config.normal_patches_jar
|
||||
integrations = self.config.normal_integrations_apk
|
||||
@@ -122,6 +121,9 @@ class Parser(object):
|
||||
args.append(arch)
|
||||
|
||||
start = perf_counter()
|
||||
logger.debug(
|
||||
f"Sending request to revanced cli for building {app} revanced with args java {args}"
|
||||
)
|
||||
process = Popen(["java", *args], stdout=PIPE)
|
||||
output = process.stdout
|
||||
if not output:
|
||||
|
||||
+5
-10
@@ -60,17 +60,14 @@ class Patches(object):
|
||||
def check_java() -> None:
|
||||
"""Check if Java17 is installed."""
|
||||
try:
|
||||
logger.debug("Checking if java is available")
|
||||
jd = subprocess.check_output(
|
||||
["java", "-version"], stderr=subprocess.STDOUT
|
||||
).decode("utf-8")
|
||||
jd = jd[1:-1]
|
||||
if "Runtime Environment" not in jd:
|
||||
logger.debug("Java Must be installed")
|
||||
exit(-1)
|
||||
raise subprocess.CalledProcessError(-1, "java -version")
|
||||
if "17" not in jd:
|
||||
logger.debug("Java 17 Must be installed")
|
||||
exit(-1)
|
||||
raise subprocess.CalledProcessError(-1, "java -version")
|
||||
logger.debug("Cool!! Java is available")
|
||||
except subprocess.CalledProcessError:
|
||||
logger.debug("Java 17 Must be installed")
|
||||
@@ -85,10 +82,9 @@ class Patches(object):
|
||||
with open("patches.json") as f:
|
||||
patches = json.load(f)
|
||||
else:
|
||||
logger.debug("fetching all patches")
|
||||
response = session.get(
|
||||
"https://raw.githubusercontent.com/revanced/revanced-patches/main/patches.json"
|
||||
)
|
||||
url = "https://raw.githubusercontent.com/revanced/revanced-patches/main/patches.json"
|
||||
logger.debug(f"fetching all patches from {url}")
|
||||
response = session.get(url)
|
||||
handle_response(response)
|
||||
patches = response.json()
|
||||
|
||||
@@ -176,7 +172,6 @@ class Patches(object):
|
||||
:param parser: Parser Obj
|
||||
:param patches: All the patches of a given app
|
||||
"""
|
||||
logger.debug(f"Excluding patches for app {app}")
|
||||
if self.config.build_extended and app in self.config.extended_apps:
|
||||
excluded_patches = self.config.env.list(
|
||||
f"EXCLUDE_PATCH_{app}_EXTENDED".upper(), []
|
||||
|
||||
Reference in New Issue
Block a user