mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-04 04:31:49 +02:00
WIP: Improve Windows QA
This commit is contained in:
parent
1f42d68259
commit
10c52dbf8c
1 changed files with 33 additions and 1 deletions
|
@ -3,14 +3,20 @@
|
|||
import abc
|
||||
import argparse
|
||||
import difflib
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
import selectors
|
||||
import subprocess
|
||||
import sys
|
||||
import urllib.request
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
PYTHON_VERSION_STR = "3.12"
|
||||
PYTHON_VERSION = [int(num) for num in PYTHON_VERSION_STR.split(".")]
|
||||
EOL_PYTHON_URL = "https://endoflife.date/api/python.json"
|
||||
|
||||
CONTENT_QA = r"""## QA
|
||||
|
||||
To ensure that new releases do not introduce regressions, and support existing
|
||||
|
@ -802,6 +808,26 @@ class QAWindows(QABase):
|
|||
while msvcrt.kbhit():
|
||||
msvcrt.getch()
|
||||
|
||||
@QABase.task(f"Install the latest version of Python {PYTHON_VERSION_STR}", ref=REF_BUILD)
|
||||
def install_python(self):
|
||||
cur_version = list(sys.version_info[:3])
|
||||
|
||||
logger.info("Getting latest Python release")
|
||||
with urllib.request.urlopen(EOL_PYTHON_URL) as f:
|
||||
resp = f.read()
|
||||
releases = json.loads(resp)
|
||||
for release in releases:
|
||||
if release["cycle"] == PYTHON_VERSION_STR:
|
||||
latest_version = [int(num) for num in release["latest"].split(".")]
|
||||
if latest_version > cur_version:
|
||||
self.prompt(f"You need to install the latest Python version ({release['latest']})")
|
||||
elif latest_version == cur_version:
|
||||
logger.info(f"Verified that the latest Python version ({release['latest']}) is installed")
|
||||
return
|
||||
|
||||
logger.error("Could not verify that the latest Python version is installed")
|
||||
|
||||
|
||||
@QABase.task("Install and Run Docker Desktop", ref=REF_BUILD)
|
||||
def install_docker(self):
|
||||
logger.info("Checking if Docker Desktop is installed and running")
|
||||
|
@ -816,12 +842,16 @@ class QAWindows(QABase):
|
|||
)
|
||||
def install_poetry(self):
|
||||
self.run("python", "-m", "pip", "install", "poetry")
|
||||
self.run("poetry", "install")
|
||||
self.run("poetry", "install", "--sync")
|
||||
|
||||
@QABase.task("Build Dangerzone container image", ref=REF_BUILD, auto=True)
|
||||
def build_image(self):
|
||||
self.run("python", r".\install\common\build-image.py")
|
||||
|
||||
@QABase.task("Download Tesseract data", ref=REF_BUILD, auto=True)
|
||||
def download_tessdata(self):
|
||||
self.run("python", r".\install\common\download-tessdata.py")
|
||||
|
||||
@QABase.task("Run tests", ref="REF_BUILD", auto=True)
|
||||
def run_tests(self):
|
||||
# NOTE: Windows does not have Makefile by default.
|
||||
|
@ -838,9 +868,11 @@ class QAWindows(QABase):
|
|||
return "windows"
|
||||
|
||||
def start(self):
|
||||
self.install_python()
|
||||
self.install_docker()
|
||||
self.install_poetry()
|
||||
self.build_image()
|
||||
self.download_tessdata()
|
||||
self.run_tests()
|
||||
self.build_dangerzone_exe()
|
||||
|
||||
|
|
Loading…
Reference in a new issue