Compare commits
3 Commits
8262256074
...
cb5991f342
| Author | SHA1 | Date | |
|---|---|---|---|
| cb5991f342 | |||
| 1ff39cdbb2 | |||
| 672b919071 |
@@ -19,6 +19,10 @@ neb install packageName@1.0.0
|
||||
(replace the number with the version number of the package you want to install)
|
||||
|
||||
## Changelog
|
||||
### 1.2.0
|
||||
- Add support for modules written in Comet
|
||||
- Made it so that you don't have to build Comet to install the headers
|
||||
|
||||
### 1.1.0
|
||||
- Switched from getting the latest commit of packages to getting the latest release
|
||||
- Added the `uninstall` subcommand
|
||||
|
||||
@@ -90,27 +90,37 @@ def install(args):
|
||||
print_error_message(f"Failed to install [b]{name}[/]: failed to read \"rock.json\" file: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
# build source code
|
||||
|
||||
rock_info = data.get("rock", {})
|
||||
|
||||
out_path = os.path.join(comet_libs_dir, f"{name}.cometlib")
|
||||
|
||||
try:
|
||||
os.chdir(temp_dir)
|
||||
os.chdir(temp_dir)
|
||||
|
||||
if rock_info.get("nativeComet") == True:
|
||||
console.print(["cp"] + glob.glob("src/*", recursive=True) + [comet_libs_dir, "-r"])
|
||||
subprocess.run(
|
||||
["gcc"] + glob.glob("src/*.c", recursive=True) + ["-fPIC", "-shared", "-Wl,-undefined,symbol_lookup", "-o", out_path] + rock_info.get("gccArgs", []),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
stdin=subprocess.PIPE,
|
||||
["cp"] + glob.glob("src/*", recursive=True) + [comet_libs_dir, "-r"],
|
||||
check=True
|
||||
)
|
||||
except KeyError as e:
|
||||
print_error_message(f"Failed to install [b]{name}[/]: \"rock.json\" is missing the key \"{e.args[0]}\"")
|
||||
sys.exit(1)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print_error_message(f"Failed to install [b]{name}[/]: build failed: \"{e.stderr.decode()}\"")
|
||||
sys.exit(1)
|
||||
console.log(f"[d][:white_check_mark:] Built {name}.[/]")
|
||||
console.log(f"[d][:white_check_mark:] Copied {name}.[/]")
|
||||
else:
|
||||
# build source code
|
||||
out_path = os.path.join(comet_libs_dir, f"{name}.cometlib")
|
||||
|
||||
try:
|
||||
|
||||
subprocess.run(
|
||||
["gcc"] + glob.glob("src/*.c", recursive=True) + ["-fPIC", "-shared", "-Wl,-undefined,symbol_lookup", "-o", out_path] + rock_info.get("gccArgs", []),
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
stdin=subprocess.PIPE,
|
||||
check=True
|
||||
)
|
||||
except KeyError as e:
|
||||
print_error_message(f"Failed to install [b]{name}[/]: \"rock.json\" is missing the key \"{e.args[0]}\"")
|
||||
sys.exit(1)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print_error_message(f"Failed to install [b]{name}[/]: build failed: \"{e.stderr.decode()}\"")
|
||||
sys.exit(1)
|
||||
console.log(f"[d][:white_check_mark:] Built {name}.[/]")
|
||||
|
||||
data_path = os.path.join(comet_libs_dir, "lib_data")
|
||||
|
||||
|
||||
@@ -29,19 +29,20 @@ def get_needed_headers() -> bool:
|
||||
console.log("[d][:white_check_mark:] Cloned Comet repo.[/]")
|
||||
|
||||
os.chdir(temp_dir)
|
||||
|
||||
status.update("Building Comet...")
|
||||
result = subprocess.run(["make"], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
if result.returncode != 0:
|
||||
print_error_message(f"failed to build Comet: {result.stderr.decode()}")
|
||||
console.log("[d][:white_check_mark:] Built Comet.[/]")
|
||||
|
||||
|
||||
status.update("Installing...")
|
||||
status.stop()
|
||||
console.print("You may need to type your admin password: ")
|
||||
result = subprocess.run(["sudo", "make", "install"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
|
||||
result = subprocess.run("sudo mkdir /usr/local/include/comet -p", stderr=subprocess.PIPE, shell=True)
|
||||
if result.returncode != 0:
|
||||
print_error_message(f"failed to install: {result.stderr.decode()}")
|
||||
return False
|
||||
|
||||
result = subprocess.run("sudo cp include/* /usr/local/include/comet -rf", stderr=subprocess.PIPE, shell=True)
|
||||
if result.returncode != 0:
|
||||
print_error_message(f"failed to install: {result.stderr.decode()}")
|
||||
return False
|
||||
|
||||
console.log("[d][:white_check_mark:] Installed headers.[/]")
|
||||
console.log("[b][:white_check_mark:] Comet headers are installed![/b]\n")
|
||||
|
||||
Reference in New Issue
Block a user