mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-27 17:35:07 +01:00
Make installed script executable. Minor clean-up of duplicate code
This commit is contained in:
parent
2eb029a7b0
commit
d6d7b9d6a8
1 changed files with 14 additions and 3 deletions
17
install.py
17
install.py
|
@ -1,6 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import pathlib
|
import pathlib
|
||||||
import argparse
|
import argparse
|
||||||
|
import os
|
||||||
|
import stat
|
||||||
|
|
||||||
|
def get_absolute(path):
|
||||||
|
return path.expanduser().absolute()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Setup Argument Parser
|
# Setup Argument Parser
|
||||||
|
@ -15,11 +20,17 @@ if __name__ == '__main__':
|
||||||
# Arrange
|
# Arrange
|
||||||
eval "$(conda shell.bash hook)"
|
eval "$(conda shell.bash hook)"
|
||||||
conda activate samvayati
|
conda activate samvayati
|
||||||
cd {args.script_dir.expanduser().absolute()}
|
cd {get_absolute(args.script_dir)}
|
||||||
|
|
||||||
# Act
|
# Act
|
||||||
python3 asymmetric.py -j {args.model_dir.expanduser().absolute()}/notes.jsonl.gz -e {args.model_dir.expanduser().absolute()}/notes_embeddings.pt -n 5 --interactive
|
python3 asymmetric.py -j {get_absolute(args.model_dir)}/notes.jsonl.gz -e {get_absolute(args.model_dir)}/notes_embeddings.pt -n 5 --interactive
|
||||||
'''
|
'''
|
||||||
|
|
||||||
with args.install_path.open(mode='w') as run_script:
|
# Create Program Script File
|
||||||
|
with open(get_absolute(args.install_path), 'w') as run_script:
|
||||||
run_script.write(run_script_content)
|
run_script.write(run_script_content)
|
||||||
|
|
||||||
|
# Make Script Executable
|
||||||
|
absolute_install_path = str(get_absolute(args.install_path))
|
||||||
|
st = os.stat(absolute_install_path)
|
||||||
|
os.chmod(absolute_install_path, st.st_mode | stat.S_IEXEC)
|
||||||
|
|
Loading…
Reference in a new issue