Include modulo in macOS packaging
This commit is contained in:
parent
4ad96eb2f3
commit
b2bfb9737f
12
packager.py
12
packager.py
|
@ -211,6 +211,16 @@ def build_mac(package_info):
|
||||||
with open(hash_file, "w") as hf:
|
with open(hash_file, "w") as hf:
|
||||||
hf.write(sha256_hash.hexdigest())
|
hf.write(sha256_hash.hexdigest())
|
||||||
|
|
||||||
|
modulo_sha_url = "https://github.com/federico-terzi/modulo/releases/download/v{0}/modulo-mac.sha256.txt".format(package_info.modulo_version)
|
||||||
|
print("Pulling SHA signature from:", modulo_sha_url)
|
||||||
|
modulo_sha_file = os.path.join(TARGET_DIR, "modulo.sha256")
|
||||||
|
urllib.request.urlretrieve(modulo_sha_url, modulo_sha_file)
|
||||||
|
modulo_sha = None
|
||||||
|
with open(modulo_sha_file, "r") as sha_f:
|
||||||
|
modulo_sha = sha_f.read()
|
||||||
|
if modulo_sha is None:
|
||||||
|
raise Exception("Cannot determine modulo SHA")
|
||||||
|
|
||||||
print("Processing Homebrew formula template")
|
print("Processing Homebrew formula template")
|
||||||
with open("packager/mac/espanso.rb", "r") as formula_template:
|
with open("packager/mac/espanso.rb", "r") as formula_template:
|
||||||
content = formula_template.read()
|
content = formula_template.read()
|
||||||
|
@ -219,6 +229,8 @@ def build_mac(package_info):
|
||||||
content = content.replace("{{{app_desc}}}", package_info.description)
|
content = content.replace("{{{app_desc}}}", package_info.description)
|
||||||
content = content.replace("{{{app_url}}}", package_info.url)
|
content = content.replace("{{{app_url}}}", package_info.url)
|
||||||
content = content.replace("{{{app_version}}}", package_info.version)
|
content = content.replace("{{{app_version}}}", package_info.version)
|
||||||
|
content = content.replace("{{{modulo_version}}}", package_info.modulo_version)
|
||||||
|
content = content.replace("{{{modulo_sha}}}", modulo_sha)
|
||||||
|
|
||||||
# Calculate hash
|
# Calculate hash
|
||||||
with open(archive_target, "rb") as f:
|
with open(archive_target, "rb") as f:
|
||||||
|
|
|
@ -4,11 +4,18 @@
|
||||||
class Espanso < Formula
|
class Espanso < Formula
|
||||||
desc "{{{app_desc}}}"
|
desc "{{{app_desc}}}"
|
||||||
homepage "{{{app_url}}}"
|
homepage "{{{app_url}}}"
|
||||||
url "https://github.com/federico-terzi/espanso/releases/latest/download/espanso-mac.tar.gz"
|
url "https://github.com/federico-terzi/espanso/releases/v{{{app_version}}}/download/espanso-mac.tar.gz"
|
||||||
sha256 "{{{release_hash}}}"
|
sha256 "{{{release_hash}}}"
|
||||||
version "{{{app_version}}}"
|
version "{{{app_version}}}"
|
||||||
|
|
||||||
|
resource "modulo" do
|
||||||
|
url "https://github.com/federico-terzi/modulo/releases/download/v{{{modulo_version}}}/modulo-mac"
|
||||||
|
sha256 "{{{modulo_sha}}}"
|
||||||
|
end
|
||||||
|
|
||||||
def install
|
def install
|
||||||
bin.install "espanso"
|
bin.install "espanso"
|
||||||
|
|
||||||
|
resource("modulo").stage { bin.install "modulo-mac" => "modulo" }
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
Reference in New Issue
Block a user