add support for beta builds
Today, I had to manually build a beta version to check if a bug existed in the latest version. However, this repo doesn't take into account beta builds. It would be great if beta releases were auto-built as well.
Attached below is a git patch to add support for beta builds based on changes I had to make today.
I didn't open a PR because I wanted to leave the final implementation to the maintainers. However, I think just including the patch file in the current branch would be easier than changing/editing files for this purpose. It would also keep the support optional and not affect the current GH actions.
The patch can be applied as usual with git am -k.
From c5b576db9a2deb2a072b1a50baa615c85bb3bf38 Mon Sep 17 00:00:00 2001
From: Aniket Teredesai <[email protected]>
Date: Sat, 2 Apr 2022 23:19:36 +0530
Subject: add support to build beta releases
---
build.py | 2 +-
shared.py | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/build.py b/build.py
index 389c249..00b0172 100644
--- a/build.py
+++ b/build.py
@@ -46,7 +46,7 @@ def extract_archive(archive: str) -> str:
"""
# given "less-561.zip", return "less-561
- zip_dest = os.path.splitext(archive)[0]
+ zip_dest = os.path.splitext(archive)[0].replace("-beta", "")
if os.path.exists(zip_dest):
print("Removing preexisting directory: %s" % (zip_dest))
diff --git a/shared.py b/shared.py
index 6232600..91411c7 100644
--- a/shared.py
+++ b/shared.py
@@ -13,7 +13,7 @@ import time
import urllib.request
LESSURL = "http://greenwoodsoftware.com/less/download.html"
-version_url_re = re.compile(r"""Download <strong>RECOMMENDED</strong> version (.*?) """, re.M | re.S | re.I)
+version_url_re = re.compile(r"""Download <strong>BETA</strong> version (.*?) """, re.M | re.S | re.I)
NEWFILE = "new.txt"
@@ -56,6 +56,6 @@ def get_latest_version_url(page: str) -> tuple:
return (None, None)
version = match[0]
- archive = "less-%s.zip" % version
+ archive = "less-%s-beta.zip" % version
url = LESSURL.replace("download.html", archive)
return version, url
--
2.35.1.windows.2
The patch can be applied as usual with
git am -k.
Are you sure this patch would build also beta releases?
I'm asking because until recently, it wasn't possible to build git snapshots of the repository, because it requires the files funcs.h and help.c which are not part of the repository, and the msvc nmake file didn't generate them, so one could only build release tarballs (which do include these files).
However, recently I added support to also build git snapshots using the msvc makefile, but it doesn't happen automatically because $reasons.
To generate funcs.h and help.c one needs to run:
nmake -f Makefile.wnm generated
and then continue normally:
nmake -f Makefile.wnm
Are you sure this patch would build also beta releases?
From what I understand of this repo, it doesn't interact with the less source on GitHub. It scrapes the source releases from http://www.greenwoodsoftware.com/less/download.html on a nightly action, checks for a new release, and builds the release if it is new. The beta builds would also be taken from http://www.greenwoodsoftware.com/less/download.html, so would already have funcs.h and help.c.
The patch is for the build script(s) in this repo that fetch the source releases, and could be applied by the GitHub action when it needs to check for beta releases, so that the python scripts don't have to be modified to support both release and beta builds.