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