summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorSainnhe Park2024-03-02 12:31:23 +0800
committerSainnhe Park2024-03-02 12:31:23 +0800
commit104b7b34c905561e9ae17a95a72557f26e6d7a85 (patch)
tree66bad2c2f0ce37f078bfbac25a5d2184bc4f6012
parenta67dbf5c57874206b4c9c95e9d70a65a6bc7a705 (diff)
downloadaur-104b7b34c905561e9ae17a95a72557f26e6d7a85.tar.gz
Add path checking
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rwxr-xr-xpatch.py27
3 files changed, 27 insertions, 8 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 596f8ba69b05..3bfc9e31c72a 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = code-features
pkgdesc = Unblock some features in Code OSS
pkgver = 1.87.0
- pkgrel = 1
+ pkgrel = 2
url = https://github.com/microsoft/vscode
install = code-features.install
arch = any
@@ -16,7 +16,7 @@ pkgbase = code-features
source = patch.py
source = patch.json
md5sums = 1d4002cba0560dd6da192ddd756f52e5
- md5sums = f11f7ccd925de0398ef2e28b127bb063
+ md5sums = 9ed6f3972479ab6d3d053e7c47ead55a
md5sums = 1d9f06e2ed16e3100f41eb6c69a81638
pkgname = code-features
diff --git a/PKGBUILD b/PKGBUILD
index 630ad06b022e..66bd501ef9e7 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: Sainnhe Park <sainnhe@gmail.com>
pkgname=code-features
pkgver=1.87.0
-pkgrel=1
+pkgrel=2
pkgdesc='Unblock some features in Code OSS'
arch=('any')
url='https://github.com/microsoft/vscode'
@@ -15,7 +15,7 @@ source=("${pkgname}.hook"
'patch.py'
'patch.json')
md5sums=('1d4002cba0560dd6da192ddd756f52e5'
- 'f11f7ccd925de0398ef2e28b127bb063'
+ '9ed6f3972479ab6d3d053e7c47ead55a'
'1d9f06e2ed16e3100f41eb6c69a81638')
package() {
diff --git a/patch.py b/patch.py
index 8e0cb7665ee8..b4710b46f633 100755
--- a/patch.py
+++ b/patch.py
@@ -11,10 +11,27 @@ product_path = "/usr/lib/code/product.json"
patch_path = "/usr/share/%s/patch.json" % pkt_name
cache_path = "/usr/share/%s/cache.json" % pkt_name
+
+class term_colors:
+ WARNING = "\033[93m"
+ ENDC = "\033[0m"
+
+
+if not os.path.exists(product_path):
+ print(
+ term_colors.WARNING
+ + "WARN: "
+ + term_colors.ENDC
+ + product_path
+ + " does not exist. You need to install extra/code in the official repository to use this package. Skipping..."
+ )
+ exit(0)
+
if not os.path.exists(cache_path):
- with open(cache_path, 'w') as file:
+ with open(cache_path, "w") as file:
file.write("{}")
+
def patch():
with open(product_path, "r") as product_file:
product_data = json.load(product_file)
@@ -26,9 +43,10 @@ def patch():
cache_data[key] = product_data[key]
product_data[key] = patch_data[key]
with open(product_path, "w") as product_file:
- json.dump(product_data, product_file, indent='\t')
+ json.dump(product_data, product_file, indent="\t")
with open(cache_path, "w") as cache_file:
- json.dump(cache_data, cache_file, indent='\t')
+ json.dump(cache_data, cache_file, indent="\t")
+
def restore():
with open(product_path, "r") as product_file:
@@ -43,7 +61,8 @@ def restore():
for key in cache_data.keys():
product_data[key] = cache_data[key]
with open(product_path, "w") as product_file:
- json.dump(product_data, product_file, indent='\t')
+ json.dump(product_data, product_file, indent="\t")
+
if operation == "patch":
patch()