REDROOM
PHP 8.2.30
Path:
Logout
Edit File
Size: 2.28 KB
Close
/opt/alt/alt-nodejs19/root/lib/node_modules/npm/node_modules/node-gyp/update-gyp.py
Text
Base64
#!/usr/libexec/platform-python import argparse import os import shutil import subprocess import tarfile import tempfile import urllib.request BASE_URL = "https://github.com/nodejs/gyp-next/archive/" CHECKOUT_PATH = os.path.dirname(os.path.realpath(__file__)) CHECKOUT_GYP_PATH = os.path.join(CHECKOUT_PATH, "gyp") parser = argparse.ArgumentParser() parser.add_argument("tag", help="gyp tag to update to") args = parser.parse_args() tar_url = BASE_URL + args.tag + ".tar.gz" changed_files = subprocess.check_output(["git", "diff", "--name-only"]).strip() if changed_files: raise Exception("Can't update gyp while you have uncommitted changes in node-gyp") with tempfile.TemporaryDirectory() as tmp_dir: tar_file = os.path.join(tmp_dir, "gyp.tar.gz") unzip_target = os.path.join(tmp_dir, "gyp") with open(tar_file, "wb") as f: print("Downloading gyp-next@" + args.tag + " into temporary directory...") print("From: " + tar_url) with urllib.request.urlopen(tar_url) as in_file: f.write(in_file.read()) print("Unzipping...") with tarfile.open(tar_file, "r:gz") as tar_ref: def is_within_directory(directory, target): abs_directory = os.path.abspath(directory) abs_target = os.path.abspath(target) prefix = os.path.commonprefix([abs_directory, abs_target]) return prefix == abs_directory def safe_extract(tar, path=".", members=None, *, numeric_owner=False): for member in tar.getmembers(): member_path = os.path.join(path, member.name) if not is_within_directory(path, member_path): raise Exception("Attempted Path Traversal in Tar File") tar.extractall(path, members, numeric_owner) safe_extract(tar_ref, unzip_target) print("Moving to current checkout (" + CHECKOUT_PATH + ")...") if os.path.exists(CHECKOUT_GYP_PATH): shutil.rmtree(CHECKOUT_GYP_PATH) shutil.move( os.path.join(unzip_target, os.listdir(unzip_target)[0]), CHECKOUT_GYP_PATH ) subprocess.check_output(["git", "add", "gyp"], cwd=CHECKOUT_PATH) subprocess.check_output(["git", "commit", "-m", "feat(gyp): update gyp to " + args.tag])
Save
Close
Exit & Reset
Text mode: syntax highlighting auto-detects file type.
Directory Contents
Dirs: 8 × Files: 10
Delete Selected
Select All
Select None
Sort:
Name
Size
Modified
Enable drag-to-move
Name
Size
Perms
Modified
Actions
.github
DIR
-
drwxr-xr-x
2024-03-03 22:54:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
bin
DIR
-
drwxr-xr-x
2024-03-03 22:54:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
docs
DIR
-
drwxr-xr-x
2024-03-03 22:54:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
gyp
DIR
-
drwxr-xr-x
2024-03-03 22:54:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
lib
DIR
-
drwxr-xr-x
2024-03-03 22:54:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
node_modules
DIR
-
drwxr-xr-x
2024-03-03 22:54:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
src
DIR
-
drwxr-xr-x
2024-03-03 22:54:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
__pycache__
DIR
-
drwxr-xr-x
2024-03-03 22:54:11
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
addon.gypi
5.80 KB
lrw-r--r--
2023-12-06 18:07:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CHANGELOG.md
91.42 KB
lrw-r--r--
2023-12-06 18:07:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
CONTRIBUTING.md
1.35 KB
lrw-r--r--
2023-12-06 18:07:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
LICENSE
1.08 KB
lrw-r--r--
2023-12-06 18:07:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
macOS_Catalina.md
6.51 KB
lrw-r--r--
2023-12-06 18:07:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
macOS_Catalina_acid_test.sh
495 B
lrw-r--r--
2023-12-06 18:07:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
package.json
1.10 KB
lrw-r--r--
2023-12-06 18:07:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
README.md
10.49 KB
lrw-r--r--
2023-12-06 18:07:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
SECURITY.md
151 B
lrw-r--r--
2023-12-06 18:07:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
update-gyp.py
2.28 KB
lrwxr-xr-x
2023-12-06 18:07:51
Edit
Download
Rename
Chmod
Change Date
Delete
OK
Cancel
recursive
OK
Cancel
recursive
OK
Cancel
Zip Selected
If ZipArchive is unavailable, a
.tar
will be created (no compression).