added the ability to install libs written in comet
also made it so you don't have to build comet to install the headers
This commit is contained in:
@@ -19,6 +19,10 @@ neb install packageName@1.0.0
|
|||||||
(replace the number with the version number of the package you want to install)
|
(replace the number with the version number of the package you want to install)
|
||||||
|
|
||||||
## Changelog
|
## Changelog
|
||||||
|
### 1.2.0
|
||||||
|
- Add support for modules written in Comet
|
||||||
|
- Made it so C headers needed to install C libs are installed for the user and not system wide
|
||||||
|
|
||||||
### 1.1.0
|
### 1.1.0
|
||||||
- Switched from getting the latest commit of packages to getting the latest release
|
- Switched from getting the latest commit of packages to getting the latest release
|
||||||
- Added the `uninstall` subcommand
|
- 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}")
|
print_error_message(f"Failed to install [b]{name}[/]: failed to read \"rock.json\" file: {e}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# build source code
|
|
||||||
rock_info = data.get("rock", {})
|
rock_info = data.get("rock", {})
|
||||||
|
os.chdir(temp_dir)
|
||||||
|
|
||||||
out_path = os.path.join(comet_libs_dir, f"{name}.cometlib")
|
if rock_info.get("nativeComet") == True:
|
||||||
|
console.print(["cp"] + glob.glob("src/*", recursive=True) + [comet_libs_dir, "-r"])
|
||||||
try:
|
|
||||||
os.chdir(temp_dir)
|
|
||||||
subprocess.run(
|
subprocess.run(
|
||||||
["gcc"] + glob.glob("src/*.c", recursive=True) + ["-fPIC", "-shared", "-Wl,-undefined,symbol_lookup", "-o", out_path] + rock_info.get("gccArgs", []),
|
["cp"] + glob.glob("src/*", recursive=True) + [comet_libs_dir, "-r"],
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
stdin=subprocess.PIPE,
|
|
||||||
check=True
|
check=True
|
||||||
)
|
)
|
||||||
except KeyError as e:
|
console.log(f"[d][:white_check_mark:] Copied {name}.[/]")
|
||||||
print_error_message(f"Failed to install [b]{name}[/]: \"rock.json\" is missing the key \"{e.args[0]}\"")
|
else:
|
||||||
sys.exit(1)
|
# build source code
|
||||||
except subprocess.CalledProcessError as e:
|
out_path = os.path.join(comet_libs_dir, f"{name}.cometlib")
|
||||||
print_error_message(f"Failed to install [b]{name}[/]: build failed: \"{e.stderr.decode()}\"")
|
|
||||||
sys.exit(1)
|
try:
|
||||||
console.log(f"[d][:white_check_mark:] Built {name}.[/]")
|
|
||||||
|
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")
|
data_path = os.path.join(comet_libs_dir, "lib_data")
|
||||||
|
|
||||||
|
|||||||
@@ -30,18 +30,19 @@ def get_needed_headers() -> bool:
|
|||||||
|
|
||||||
os.chdir(temp_dir)
|
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.update("Installing...")
|
||||||
status.stop()
|
status.stop()
|
||||||
console.print("You may need to type your admin password: ")
|
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:
|
if result.returncode != 0:
|
||||||
print_error_message(f"failed to install: {result.stderr.decode()}")
|
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("[d][:white_check_mark:] Installed headers.[/]")
|
||||||
console.log("[b][:white_check_mark:] Comet headers are installed![/b]\n")
|
console.log("[b][:white_check_mark:] Comet headers are installed![/b]\n")
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -5,7 +5,7 @@ with open("neb/README.md", "r") as f:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="nebpkg",
|
name="nebpkg",
|
||||||
version="1.1.0",
|
version="1.2.0",
|
||||||
description="Nebula, the package manager for the Comet programming language.",
|
description="Nebula, the package manager for the Comet programming language.",
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
|
|||||||
Reference in New Issue
Block a user