Commit c4d10f0a authored by Theresa Pollinger's avatar Theresa Pollinger
Browse files

made additional data files installable and executable

parent 3dc6b591
include interview_kernel/exastencils/compiler.jar
include interview_kernel/exastencils/generate_compile_and_run_list.sh
recursive-include interview_kernel/exastencils/lib *.*
......@@ -6,8 +6,7 @@ from this directory, run
```shell
pip install .
python setup.py install
cd interview_kernel
python install.py
python -m interview_kernel.install
```
## Running
......@@ -18,7 +17,8 @@ You can then run the interview_kernel kernel as a console, notebook, etc.:
jupyter console --kernel=interview_kernel
```
## Dependencies
or
1. IPython 3
1. MetaKernel (installed with pip)
```shell
jupyter notebook --kernel=interview_kernel
```
import os
from pathlib import Path
from tempfile import gettempdir
import subprocess
from collections import OrderedDict
from pylatexenc.latexencode import utf8tolatex, utf82latex
......@@ -18,7 +19,7 @@ class ExaOutput:
but only if simdata is given"""
def __init__(self, simdata=None, username="user", probname=None):
remove_ensuremaths()
self.exastencils_path = Path("./exastencils")
self.exastencils_path = Path(os.path.dirname(__file__)).joinpath("./exastencils")
self.username = username
......@@ -50,15 +51,19 @@ class ExaOutput:
("timeStrategies", True),
("buildfileGenerators", "{ \"MakefileGenerator\" }")
])
self.tmppath = Path(gettempdir())
self.dirpath = self.exastencils_path.joinpath(self.probname)
self.filespath = self.dirpath.joinpath(self.probname)
ff = str(self.dirpath)
if not os.path.exists(ff):
try:
os.makedirs(ff)
except OSError as exc:# Guard against race condition
if exc.errno != errno.EEXIST:
raise
ff = [self.dirpath] # , self.tmppath.joinpath("generated"), self.tmppath.joinpath("Debug")]
for f in ff:
if not os.path.exists(str(f)):
try:
os.makedirs(str(f))
except OSError as exc:# Guard against race condition
if exc.errno != errno.EEXIST:
raise
# # and link it into the exastencils directory
# os.symlink(str(f), str(self.exastencils_path.joinpath(os.path.basename(os.path.normpath(f)))))
if simdata is not None:
self.create_settings()
# self.create_platform()
......@@ -242,7 +247,7 @@ class ExaOutput:
"\n"
"\n"
"configList=\"\" \n"\
"configList+=\"{}/{} \" \n".format(self.probname, self.probname))
"configList+=\"{}/{} \" \n".format(self.probname, self.probname)) #(self.dirpath, self.probname))
class ExaRunner:
"""A class to run exastencils using the files generated by an Exaoutput class, and to get the results"""
......@@ -253,6 +258,7 @@ class ExaRunner:
self.exaout = exaout
def run_exastencils(self):
# print(str(os.path.abspath(self.exaout.exastencils_path)))
p = subprocess.run(["./generate_compile_and_run_list.sh"], cwd=str(self.exaout.exastencils_path),
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
out = p.stdout
......
......@@ -20,12 +20,15 @@ setup(
# replicating contents of MANIFEST,
# cf.https://stackoverflow.com/questions/7522250/how-to-include-package-data-with-setuptools-distribute/14159430#14159430
package_data={
'interview_kernel': ['interview_kernel/exastencils/compiler.jar',
'interview_kernel/exastencils/generate_compile_and_run_list.sh',
'interview_kernel/exastencils/lib/*.*'],
'interview_kernel': ['exastencils/compiler.jar',
'exastencils/generate_compile_and_run_list.sh',
'exastencils/lib/*.*'],
},
# data_files=[
# ],
zip_safe=False,
# use_scm_version=True,
setup_requires=['setuptools_scm'], # or possibly https://pypi.python.org/pypi/setuptools-git
install_requires=['transitions', 'bokeh', 'requests', 'pylatexenc', 'metakernel', 'lxml', 'IPython', 'jupyter_client', 'ipywidgets']
install_requires=['transitions', 'bokeh', 'pandas', 'requests', 'pylatexenc', 'metakernel', 'lxml',
'IPython', 'jupyter_client', 'ipywidgets']
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment