diff options
author | Ethan Kerrick | 2023-02-03 13:17:43 -0500 |
---|---|---|
committer | Ethan Kerrick | 2023-02-03 13:17:43 -0500 |
commit | bcd4fb7970bc7485c3a167d73f6bb281bd79f71c (patch) | |
tree | f6aec04019ea2523a521143959bace437b337b78 | |
parent | a683987c202942cc524262f2b307ada80ceacaf3 (diff) | |
download | aur-bcd4fb7970bc7485c3a167d73f6bb281bd79f71c.tar.gz |
switch to patch.py to be inline with vscodium-bin-features
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | PKGBUILD | 12 | ||||
-rw-r--r-- | patch.py | 148 | ||||
-rwxr-xr-x | patch.sh | 13 | ||||
-rw-r--r-- | vscodium-features.hook | 2 | ||||
-rw-r--r-- | vscodium-features.install | 8 |
6 files changed, 165 insertions, 29 deletions
@@ -1,19 +1,20 @@ pkgbase = vscodium-features pkgdesc = Unblock some features in VSCodium pkgver = 1.74.0 - pkgrel = 1 + pkgrel = 2 url = https://github.com/microsoft/vscode install = vscodium-features.install arch = any license = unknown depends = vscodium - depends = sed + depends = python + depends = python-requests optdepends = org.freedesktop.secrets: for settings sync feature provides = vscodium-features conflicts = vscodium-features source = vscodium-features.hook - source = patch.sh - md5sums = 1f08c4648040bc4e90d483764851b421 - md5sums = c95895a704eaa138aa014d4783b19032 + source = patch.py + md5sums = c83958259eb32492073e5e1390f4f5cd + md5sums = d3911dc497ccc9aa520d6e46149a9399 pkgname = vscodium-features @@ -4,22 +4,22 @@ pkgname=vscodium-features pkgver=1.74.0 -pkgrel=1 +pkgrel=2 pkgdesc='Unblock some features in VSCodium' arch=('any') url='https://github.com/microsoft/vscode' license=('unknown') -depends=('vscodium' 'sed') +depends=('vscodium' 'python' 'python-requests') optdepends=('org.freedesktop.secrets: for settings sync feature') provides=('vscodium-features') conflicts=('vscodium-features') install="${pkgname}.install" source=("${pkgname}.hook" - 'patch.sh') -md5sums=('1f08c4648040bc4e90d483764851b421' - 'c95895a704eaa138aa014d4783b19032') + 'patch.py') +md5sums=('c83958259eb32492073e5e1390f4f5cd' + 'd3911dc497ccc9aa520d6e46149a9399') package() { install -Dm 644 "${srcdir}/${pkgname}.hook" "${pkgdir}/usr/share/libalpm/hooks/${pkgname}.hook" - install -Dm 755 "${srcdir}/patch.sh" "${pkgdir}/usr/share/${pkgname}/patch.sh" + install -Dm 755 "${srcdir}/patch.py" "${pkgdir}/usr/share/${pkgname}/patch.py" } diff --git a/patch.py b/patch.py new file mode 100644 index 000000000000..3676e90d96e6 --- /dev/null +++ b/patch.py @@ -0,0 +1,148 @@ +#!/usr/bin/env python +from sys import argv +from json import load, dump, JSONDecodeError +from requests import get + +PRODUCT_JSON_LOCATION = "/opt/vscodium-bin/resources/app/product.json" + + +if __name__ == "__main__": + try: + with open(PRODUCT_JSON_LOCATION) as file: + product = load(file) + except JSONDecodeError: + result = get('https://github.com/microsoft/vscode/raw/main/product.json') + if result.ok: + product = result.json() + else: + print( + "error: couldn't parse local product.json or fetch a new one from the web") + exit(1) + if '-R' in argv: + product["nameLong"] = "VSCodium" + product.pop("auth", None) + product.pop("configurationSync.store", None) + product.pop("editSessions.store", None) + product.pop("extensionEnabledApiProposals", None) + else: + product["nameLong"] = "Visual Studio Code" + product["auth"] = { + "loginUrl": "https://login.microsoftonline.com/common/oauth2/authorize", + "tokenUrl": "https://login.microsoftonline.com/common/oauth2/token", + "redirectUrl": "https://vscode-redirect.azurewebsites.net/", + "clientId": "aebc6443-996d-45c2-90f0-388ff96faa56" + } + product["configurationSync.store"] = { + "url": "https://vscode-sync.trafficmanager.net/", + "stableUrl": "https://vscode-sync.trafficmanager.net/", + "insidersUrl": "https://vscode-sync-insiders.trafficmanager.net/", + "canSwitch": False, + "authenticationProviders": { + "microsoft": { + "scopes": ["openid", "profile", "email", "offline_access"] + }, + "github": { + "scopes": ["user:email"] + } + } + } + product["editSessions.store"] = { + "url": "https://vscode-sync.trafficmanager.net/", + "authenticationProviders": { + "microsoft": { + "scopes": ["openid", "profile", "email", "offline_access"] + }, + "github": { + "scopes": ["user:email"] + } + } + } + product["extensionEnabledApiProposals"] = { + "ms-vscode.vscode-selfhost-test-provider": ["testObserver"], + "VisualStudioExptTeam.vscodeintellicode-completions": ["inlineCompletionsAdditions"], + "ms-vsliveshare.vsliveshare": [ + "contribMenuBarHome", "diffCommand", + "documentFiltersExclusive", "fileSearchProvider", + "findTextInFiles", "notebookCellExecutionState", + "notebookLiveShare", "terminalDimensions", + "terminalDataWriteEvent", "textSearchProvider" + ], + "ms-vscode.js-debug": [ + "portsAttributes", "findTextInFiles", "workspaceTrust", + "tunnels" + ], + "ms-toolsai.vscode-ai-remote": ["resolvers"], + "ms-python.python": ["quickPickSortByLabel", "testObserver", "telemetryLogger"], + "ms-dotnettools.dotnet-interactive-vscode": ["notebookMessaging"], + "GitHub.codespaces": [ + "contribEditSessions", "contribMenuBarHome", + "contribRemoteHelp", "contribViewsRemote", "resolvers", + "tunnels", "terminalDataWriteEvent", "treeViewReveal", + "notebookKernelSource" + ], + "ms-vscode.azure-repos": [ + "extensionRuntime", "fileSearchProvider", "telemetryLogger", + "textSearchProvider" + ], + "ms-vscode.remote-repositories": [ + "contribEditSessions", "contribRemoteHelp", + "contribMenuBarHome", "contribViewsRemote", + "contribViewsWelcome", "contribShareMenu", + "documentFiltersExclusive", "editSessionIdentityProvider", + "extensionRuntime", "fileSearchProvider", + "quickPickSortByLabel", "workspaceTrust", "scmActionButton", + "scmSelectedProvider", "scmValidation", "telemetryLogger", + "textSearchProvider", "timeline" + ], + "ms-vscode-remote.remote-wsl": ["resolvers", "contribViewsRemote", "telemetry"], + "ms-vscode-remote.remote-ssh": [ + "resolvers", "tunnels", "terminalDataWriteEvent", + "contribViewsRemote", "telemetry" + ], + "ms-vscode.remote-server": ["resolvers"], + "ms-vscode.remote-explorer": ["contribViewsRemote", "extensionsAny"], + "ms-vscode-remote.remote-containers": [ + "contribEditSessions", "resolvers", "tunnels", + "workspaceTrust", "terminalDimensions", "contribViewsRemote" + ], + "ms-vscode.js-debug-nightly": [ + "portsAttributes", "findTextInFiles", "workspaceTrust", + "tunnels" + ], + "ms-vscode.lsif-browser": ["documentFiltersExclusive"], + "GitHub.vscode-pull-request-github": [ + "contribCommentThreadAdditionalMenu", "tokenInformation", + "commentsResolvedState", "contribShareMenu", + "contribCommentPeekContext", "treeItemCheckbox", + "codiconDecoration", "diffCommand" + ], + "GitHub.copilot": ["inlineCompletionsAdditions"], + "GitHub.copilot-nightly": ["inlineCompletionsAdditions"], + "GitHub.remotehub": [ + "contribRemoteHelp", "contribMenuBarHome", + "contribViewsRemote", "contribViewsWelcome", + "documentFiltersExclusive", "extensionRuntime", + "fileSearchProvider", "quickPickSortByLabel", "workspaceTrust", + "scmSelectedProvider", "scmValidation", "textSearchProvider", + "timeline", "telemetryLogger" + ], + "ms-python.gather": ["notebookCellExecutionState"], + "ms-python.vscode-pylance": ["notebookCellExecutionState"], + "ms-toolsai.jupyter-renderers": ["contribNotebookStaticPreloads"], + "ms-toolsai.jupyter": [ + "notebookControllerKind", "notebookDeprecated", + "notebookMessaging", "notebookMime", + "notebookCellExecutionState", "portsAttributes", + "quickPickSortByLabel", "notebookKernelSource", + "interactiveWindow", "notebookControllerAffinityHidden", + "contribNotebookStaticPreloads" + ], + "dbaeumer.vscode-eslint": ["notebookCellExecutionState"], + "ms-vscode.azure-sphere-tools-ui": ["tunnels"], + "ms-azuretools.vscode-azureappservice": ["terminalDataWriteEvent"], + "ms-vscode.anycode": ["extensionsAny"], + "ms-vscode.cpptools": ["terminalDataWriteEvent"], + "redhat.java": ["documentPaste"] + } + with open(PRODUCT_JSON_LOCATION, mode='w') as file: + dump(product, file, indent=4) diff --git a/patch.sh b/patch.sh deleted file mode 100755 index 3e3a35017293..000000000000 --- a/patch.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env sh - -if [ "${1}" = "-R" ]; then - sed -i -e 's/^[[:blank:]]*"nameLong":.*/ "nameLong": "VSCodium",/' \ - -e '/^[[:blank:]]*"extensionEnabledApiProposals"/d' \ - -e '/^[[:blank:]]*"extensionSyncedKeys/d' \ - /usr/share/vscodium/resources/app/product.json -else - sed -i -e 's/^[[:blank:]]*"nameLong":.*/ "nameLong": "Visual Studio Code",/' \ - -e '/^[[:blank:]]*"extensionsGallery"/i extensionEnabledApiProposals": { "ms-vscode.vscode-selfhost-test-provider": ["testObserver"], "VisualStudioExptTeam.vscodeintellicode-completions": ["inlineCompletionsAdditions"], "ms-vsliveshare.vsliveshare": ["contribMenuBarHome", "diffCommand", "documentFiltersExclusive", "fileSearchProvider", "findTextInFiles", "notebookCellExecutionState", "notebookLiveShare", "terminalDimensions", "terminalDataWriteEvent", "textSearchProvider"], "ms-vscode.js-debug": ["portsAttributes", "findTextInFiles", "workspaceTrust", "tunnels"], "ms-toolsai.vscode-ai-remote": ["resolvers"], "ms-python.python": ["quickPickSortByLabel", "testObserver", "telemetryLogger"], "ms-dotnettools.dotnet-interactive-vscode": ["notebookMessaging"], "GitHub.codespaces": ["contribEditSessions", "contribMenuBarHome", "contribRemoteHelp", "contribViewsRemote", "resolvers", "tunnels", "terminalDataWriteEvent", "treeViewReveal", "notebookKernelSource"], "ms-vscode.azure-repos": ["extensionRuntime", "fileSearchProvider", "telemetryLogger", "textSearchProvider"], "ms-vscode.remote-repositories": ["contribEditSessions", "contribRemoteHelp", "contribMenuBarHome", "contribViewsRemote", "contribViewsWelcome", "contribShareMenu", "documentFiltersExclusive", "editSessionIdentityProvider", "extensionRuntime", "fileSearchProvider", "quickPickSortByLabel", "workspaceTrust", "scmActionButton", "scmSelectedProvider", "scmValidation", "telemetryLogger", "textSearchProvider", "timeline"], "ms-vscode-remote.remote-wsl": ["resolvers", "contribViewsRemote", "telemetry"], "ms-vscode-remote.remote-ssh": ["resolvers", "tunnels", "terminalDataWriteEvent", "contribViewsRemote", "telemetry"], "ms-vscode.remote-server": ["resolvers"], "ms-vscode.remote-explorer": ["contribViewsRemote", "extensionsAny"], "ms-vscode-remote.remote-containers": ["contribEditSessions", "resolvers", "tunnels", "workspaceTrust", "terminalDimensions", "contribViewsRemote"], "ms-vscode.js-debug-nightly": ["portsAttributes", "findTextInFiles", "workspaceTrust", "tunnels"], "ms-vscode.lsif-browser": ["documentFiltersExclusive"], "GitHub.vscode-pull-request-github": ["contribCommentThreadAdditionalMenu", "tokenInformation", "commentsResolvedState", "contribShareMenu", "contribCommentPeekContext", "treeItemCheckbox", "codiconDecoration", "diffCommand"], "GitHub.copilot": ["inlineCompletionsAdditions"], "GitHub.copilot-nightly": ["inlineCompletionsAdditions"], "GitHub.remotehub": ["contribRemoteHelp", "contribMenuBarHome", "contribViewsRemote", "contribViewsWelcome", "documentFiltersExclusive", "extensionRuntime", "fileSearchProvider", "quickPickSortByLabel", "workspaceTrust", "scmSelectedProvider", "scmValidation", "textSearchProvider", "timeline", "telemetryLogger"], "ms-python.gather": ["notebookCellExecutionState"], "ms-python.vscode-pylance": ["notebookCellExecutionState"], "ms-toolsai.jupyter-renderers": ["contribNotebookStaticPreloads"], "ms-toolsai.jupyter": ["notebookControllerKind", "notebookDeprecated", "notebookMessaging", "notebookMime", "notebookCellExecutionState", "portsAttributes", "quickPickSortByLabel", "notebookKernelSource", "interactiveWindow", "notebookControllerAffinityHidden", "contribNotebookStaticPreloads"], "dbaeumer.vscode-eslint": ["notebookCellExecutionState"], "ms-vscode.azure-sphere-tools-ui": ["tunnels"], "ms-azuretools.vscode-azureappservice": ["terminalDataWriteEvent"], "ms-vscode.anycode": ["extensionsAny"], "ms-vscode.cpptools": ["terminalDataWriteEvent"], "redhat.java": ["documentPaste"] },' \ - -e '/^[[:blank:]]*"extensionsGallery/i\\t"extensionSyncedKeys": { "ritwickdey.liveserver": ["liveServer.setup.version"] }, "auth": { "loginUrl": "https:\/\/login.microsoftonline.com\/common\/oauth2\/authorize", "tokenUrl": "https:\/\/login.microsoftonline.com\/common\/oauth2\/token", "redirectUrl": "https:\/\/vscode-redirect.azurewebsites.net\/", "clientId": "aebc6443-996d-45c2-90f0-388ff96faa56" }, "configurationSync.store": { "url": "https:\/\/vscode-sync.trafficmanager.net\/", "stableUrl": "https:\/\/vscode-sync.trafficmanager.net\/", "insidersUrl": "https:\/\/vscode-sync-insiders.trafficmanager.net\/", "canSwitch": false, "authenticationProviders": { "microsoft": { "scopes": ["openid", "profile", "email", "offline_access"] }, "github": { "scopes": ["user:email"] } } }, "editSessions.store": { "url": "https:\/\/vscode-sync.trafficmanager.net\/", "authenticationProviders": { "microsoft": { "scopes": ["openid", "profile", "email", "offline_access"] }, "github": { "scopes": ["user:email"] } } },' \ - /usr/share/vscodium/resources/app/product.json -fi diff --git a/vscodium-features.hook b/vscodium-features.hook index 2131fa2e272c..02283536bdd5 100644 --- a/vscodium-features.hook +++ b/vscodium-features.hook @@ -6,5 +6,5 @@ Target = vscodium [Action] Description = [vscodium-features] Patching product.json... -Exec = /usr/share/vscodium-features/patch.sh +Exec = /usr/share/vscodium-features/patch.py When = PostTransaction diff --git a/vscodium-features.install b/vscodium-features.install index a8fedd428d64..84008411bd62 100644 --- a/vscodium-features.install +++ b/vscodium-features.install @@ -1,15 +1,15 @@ post_install() { - /usr/share/vscodium-features/patch.sh + /usr/share/vscodium-features/patch.py } pre_upgrade() { - /usr/share/vscodium-features/patch.sh -R + /usr/share/vscodium-features/patch.py -R } post_upgrade() { - /usr/share/vscodium-features/patch.sh + /usr/share/vscodium-features/patch.py } pre_remove() { - /usr/share/vscodium-features/patch.sh -R + /usr/share/vscodium-features/patch.py -R } |