From 37056b20e4d3e890959aef04de031c95c4346360 Mon Sep 17 00:00:00 2001
From: Alan De Smet <alan.desmet@ssec.wisc.edu>
Date: Thu, 2 Sep 2021 15:41:56 +0000
Subject: [PATCH] Add setup script for example dev environment
Eliminates the need for the scripts change their own sys.path. Also gets
the non-stock dateutil.parser
---
example/aitf/ancil.py | 1 -
example/setup-testing | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 1 deletion(-)
create mode 100755 example/setup-testing
diff --git a/example/aitf/ancil.py b/example/aitf/ancil.py
index e854081..b82f0ca 100644
--- a/example/aitf/ancil.py
+++ b/example/aitf/ancil.py
@@ -20,7 +20,6 @@
import os
import sys
import datetime as dt
-#sys.path.append(os.path.abspath(os.path.dirname(__file__)+'/../..'))
import csppfetch
import csppfetch.daterange
from csppfetch.roundtozero import roundtozero
diff --git a/example/setup-testing b/example/setup-testing
new file mode 100755
index 0000000..b24cb77
--- /dev/null
+++ b/example/setup-testing
@@ -0,0 +1,19 @@
+#! /bin/sh
+set -e
+
+run() {
+ # I'm not using "set -x" because activate/deactivate are unhelpfully noisy
+ echo "$@"
+ "$@"
+}
+
+run python3 -mvenv venv
+run . venv/bin/activate
+run pip install python-dateutil -q
+run deactivate
+run ln -s venv/lib/python3.6/site-packages/six.py .
+run ln -s venv/lib/python3.6/site-packages/dateutil .
+run ln -s ../csppfetch .
+# Test modules are available
+run python3 -c "import dateutil.parser"
+run python3 -c "import csppfetch"
--
GitLab