Skip to content

Commit

Permalink
build: Update readme and release to point to GitHub releases (#1115)
Browse files Browse the repository at this point in the history
Instead of depending on 4DNucleome server, just point to GitHub
artifacts

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## 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.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
  • Loading branch information
Czaki and coderabbitai[bot] authored Jul 2, 2024
1 parent 1eb2297 commit c41e051
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
8 changes: 4 additions & 4 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions build_utils/create_and_pack_executable.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import tarfile
import zipfile

import tqdm
from PyInstaller.__main__ import run as pyinstaller_run

import PartSeg
Expand All @@ -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")
Expand Down Expand Up @@ -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)
Expand All @@ -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__":
Expand Down
8 changes: 5 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("# ", "## ")
Expand Down

0 comments on commit c41e051

Please sign in to comment.