Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes - Parallel errors, extension for Windows, import errors, path #8

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ old_versions
data
pythoninterpreter.py
*.tar
.vscode
tmp/*
50 changes: 0 additions & 50 deletions bin/quantum-honeycomp

This file was deleted.

55 changes: 55 additions & 0 deletions bin/quantum-honeycomp.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import os
import sys
import platform
import argparse
import subprocess
from pathlib import Path


parser = argparse.ArgumentParser()
parser.add_argument("--utility", default="",
help='Just use a utility and exit')
parser.add_argument("--python", default="",
help='Default Python interpreter')
args = parser.parse_args() # get the arguments


def get_qhroot():
"""Gets the root path of quantum honeycomp"""
return Path(__file__).resolve().parent.parent


qhroot = get_qhroot() # get the root path
os.environ["QHROOT"] = str(qhroot) # create the environmental variable


def get_command(name="python"):
"""Return the path for Anaconda Python, which has pyqt by default"""
#dirname = os.path.dirname(os.path.realpath(__file__))
qhroot = get_qhroot()
path = qhroot.joinpath("pysrc", "interpreter")
sys.path.insert(1, str(path)) # add this path
print("Path: ", str(path))
import pycommand
return pycommand.get_python()


python = get_command()


if args.python != "": # non empty string
path = qhroot.joinpath("pysrc", "interpreter", "pythoninterpreter.py")
with open(path, mode='wt') as config:
config.write("mainpython = r\""+args.python+"\"\n")


# Use a utility and exit
if args.utility != "": # non empty string
utility = qhroot.joinpath('utilities')
subprocess.run(["python", str(utility), args.utility])
#os.system(python + " "+qhroot+"/utilities/"+args.utility)
exit()


pyqt = qhroot.joinpath('bin', "versions", "quantum-honeycomp-pyqt")
subprocess.run(["python", str(pyqt)])
1 change: 1 addition & 0 deletions bin/versions/quantum-honeycomp-pyqt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import sys
import os
import platform
from pathlib import Path


# Add path of the interface
Expand Down
Loading