Compare commits

..

No commits in common. "76c1a5fd0430f5891cdd9b69993d274b348f93e0" and "6982b319961704c91e4eb30a20b8c6b8915100f4" have entirely different histories.

9 changed files with 3 additions and 25 deletions

1
.gitignore vendored
View file

@ -14,4 +14,3 @@ public/
**/*.egg-info
build/
dist/
**/node_modules

View file

@ -1,11 +1,10 @@
[build-system]
requires = ["setuptools>=61.0","setuptools_scm[toml]>=6.2"]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "formatitko"
#version = "0.0.1"
dynamic = ["version"]
version = "0.0.1"
authors = [
{ name="Greenscreener ", email="gs@grsc.cz" },
{ name="Organizers of KSP", email="ksp-tech@ksp.mff.cuni.cz" }
@ -25,11 +24,3 @@ classifiers = [
[project.scripts]
formatitko = "formatitko.formatitko:main"
[tool.setuptools_scm]
[tool.setuptools.packages.find]
where = ["src"]
exclude = ["src/formatitko/katex-server/node_modules"]

View file

@ -16,19 +16,7 @@ class KatexClient:
self._temp_dir = tempfile.TemporaryDirectory(prefix='formatitko')
self._socket_file = self._temp_dir.name + "/katex-socket"
srcdir = os.path.dirname(os.path.realpath(__file__))
# Test if `node_modules` directory exists and if not, run `npm install`
if not os.path.isdir(srcdir + "/katex-server/node_modules"):
print("Installing node dependencies for the first time...")
try:
subprocess.run(["npm", "install"], cwd=srcdir+"/katex-server", check=True)
except subprocess.CalledProcessError as e:
if e.returncode == 127:
raise Exception("npm not found. Node.js is required to use KaTeX.")
else:
raise e
self._server_process = subprocess.Popen(["node", srcdir + "/katex-server/index.mjs", self._socket_file])
self._server_process = subprocess.Popen(["node", os.path.dirname(os.path.realpath(__file__)) + "/katex-server/index.mjs", self._socket_file])
self._client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)