From e88fd81a3d19f434078f5b775415d53e326e5eb4 Mon Sep 17 00:00:00 2001
From: chrysn <chrysn@fsfe.org>
Date: Wed, 13 Sep 2017 14:17:54 +0200
Subject: [PATCH] setup: fixes for other `setup.py test`

* work relative to __file__ rather than assuming that setup.py is in the
  working directory

* update the submodule (it might be practical for some cases to make
  that conditional on the submodule directory being empty)
---
 setup.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/setup.py b/setup.py
index e4db61c..1b91def 100644
--- a/setup.py
+++ b/setup.py
@@ -1,3 +1,4 @@
+import os.path
 import subprocess
 
 from distutils.core import setup
@@ -9,8 +10,9 @@ class prepare_tinydtls(build_ext):
     def run(self):
         def run_command(args):
             print("Running:", " ".join(args))
-            subprocess.check_call(args, cwd="./DTLSSocket/tinydtls")
+            subprocess.check_call(args, cwd=os.path.join(os.path.dirname(__file__), "./DTLSSocket/tinydtls"))
         commands = [
+            ["git", "submodule", "update", "--init"],
             ["autoconf"],
             ["autoheader"],
             ["./configure", "--without-ecc"],
-- 
GitLab