From c41e0514d83c176816262a0f979935d9db5094c3 Mon Sep 17 00:00:00 2001 From: Grzegorz Bokota Date: Wed, 3 Jul 2024 01:42:50 +0200 Subject: [PATCH] build: Update readme and release to point to GitHub releases (#1115) Instead of depending on 4DNucleome server, just point to GitHub artifacts ## Summary by CodeRabbit - **New Features** - Updated download URLs to point to GitHub releases for easier access to the latest binaries. - **Chores** - Updated VM image in Azure Pipelines to Ubuntu 22.04 for enhanced compatibility. - Improved build script to include versioning and progress indicators. - **Documentation** - Enhanced `pyproject.toml` to dynamically include readme information. --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- Readme.md | 8 ++++---- azure-pipelines.yml | 2 +- build_utils/create_and_pack_executable.py | 17 ++++++++++++----- pyproject.toml | 8 +++++--- setup.py | 5 +++-- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/Readme.md b/Readme.md index e00b23022..c58e51931 100644 --- a/Readme.md +++ b/Readme.md @@ -34,10 +34,10 @@ This application is designed to help biologist with segmentation based on thresh - From binaries: - - [Windows](https://4dnucleome.cent.uw.edu.pl/PartSeg/Downloads/PartSeg-lastest-windows.zip) (build on Windows 10) - - [Linux](https://4dnucleome.cent.uw.edu.pl/PartSeg/Downloads/PartSeg-lastest-linux.zip) (build on Ubuntu 20.04) - - [MacOS](https://4dnucleome.cent.uw.edu.pl/PartSeg/Downloads/PartSeg-lastest-macos.zip) (build on MacOS 11) - There are reported problems with permissions systems on macOS. If you have problem with starting application please try to run it from terminal. + - [Windows](https://github.com/4DNucleome/PartSeg/releases/latest/download/PartSeg-windows.zip) (build on Windows 10) + - [Linux](https://github.com/4DNucleome/PartSeg/releases/latest/download/PartSeg-linux.zip) (build on Ubuntu 20.04) + - [macOS](https://github.com/4DNucleome/PartSeg/releases/latest/download/PartSeg-macos.zip) (build on macOS 11) + There are reported problems with permissions systems on macOS. If you have a problem with starting the application, please try to run it from the terminal. - With pip: diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 44c64623d..0eab8d0b5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -152,7 +152,7 @@ stages: dependsOn: GetTestData jobs: - job: sdist - pool: {vmImage: 'Ubuntu-20.04'} + pool: {vmImage: 'Ubuntu-22.04'} steps: - task: UsePythonVersion@0 - bash: pip install -r requirements/requirements_dev.txt diff --git a/build_utils/create_and_pack_executable.py b/build_utils/create_and_pack_executable.py index d706a7c6e..0604b70dd 100644 --- a/build_utils/create_and_pack_executable.py +++ b/build_utils/create_and_pack_executable.py @@ -6,6 +6,7 @@ import tarfile import zipfile +import tqdm from PyInstaller.__main__ import run as pyinstaller_run import PartSeg @@ -16,9 +17,12 @@ SYSTEM_NAME_DICT = {"Linux": "linux", "Windows": "windows", "Darwin": "macos"} -def create_archive(working_dir): +def create_archive(working_dir, with_version=True): os.makedirs(os.path.join(working_dir, "dist2"), exist_ok=True) - file_name = f"PartSeg-{PartSeg.__version__}-{SYSTEM_NAME_DICT[platform.system()]}" + if with_version: + file_name = f"PartSeg-{PartSeg.__version__}-{SYSTEM_NAME_DICT[platform.system()]}" + else: + file_name = f"PartSeg-{SYSTEM_NAME_DICT[platform.system()]}" if platform.system() != "Darwin": return zipfile.ZipFile(os.path.join(working_dir, "dist2", f"{file_name}.zip"), "w", zipfile.ZIP_DEFLATED) arch_file = tarfile.open(os.path.join(working_dir, "dist2", f"{file_name}.tgz"), "w:gz") @@ -48,11 +52,13 @@ def create_bundle(spec_path, working_dir): pyinstaller_run(pyinstaller_args) -def archive_build(working_dir, dir_name): +def archive_build(working_dir, dir_name, with_version=True): base_zip_path = os.path.join(working_dir, "dist") - with create_archive(working_dir) as arch_file: - for root, _dirs, files in os.walk(os.path.join(working_dir, "dist", dir_name), topdown=False, followlinks=True): + with create_archive(working_dir, with_version=with_version) as arch_file: + for root, _dirs, files in tqdm.tqdm( + os.walk(os.path.join(working_dir, "dist", dir_name), topdown=False, followlinks=True) + ): for file_name in files: arch_file.write( os.path.join(root, file_name), os.path.relpath(os.path.join(root, file_name), base_zip_path) @@ -74,6 +80,7 @@ def main(): fix_qt_location(args.working_dir, dir_name) archive_build(args.working_dir, dir_name) + archive_build(args.working_dir, dir_name, with_version=False) if __name__ == "__main__": diff --git a/pyproject.toml b/pyproject.toml index 6bab2450e..6956e3126 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,10 +77,12 @@ dependencies = [ ] dynamic = [ "version", + "readme", ] -[project.readme] -file = "Readme.md" -content-type = "text/markdown" + +#[project.readme] +#file = "Readme.md" +#content-type = "text/markdown" [project.license] text = "BSD-3-Clause" diff --git a/setup.py b/setup.py index 61eb8ffd1..129786698 100644 --- a/setup.py +++ b/setup.py @@ -17,14 +17,15 @@ def read(*parts): def readme(): this_directory = os.path.abspath(os.path.dirname(__file__)) reg = re.compile(r"(!\[[^]]*\])\((images/[^)]*)\)") - reg2 = re.compile(r"PartSeg-lastest") + reg2 = re.compile(r"releases/latest/download/PartSeg") with open(os.path.join(this_directory, "Readme.md")) as f: text = f.read() text = reg.sub(r"\1(https://raw.githubusercontent.com/4DNucleome/PartSeg/master/\2)", text) with contextlib.suppress(ImportError): from setuptools_scm import get_version - text = reg2.sub(f"PartSeg-{get_version()}", text) + text = reg2.sub(f"releases/download/v{get_version()}/PartSeg-{get_version()}", text) + with open(os.path.join(this_directory, "changelog.md")) as f: chg = f.read() text += "\n\n" + chg.replace("# ", "## ")