Repository: precice/fenics-adapter (language: python)

Issue:
from fenics import * avoids publishing
See https://github.com/precice/fenics-adapter/runs/2354843276

The changes introduced in #120 make `fenics` a dependency for being able to run `setup.py`, even if you don't actually need it. This breaks `python3 setup.py sdist` in our publishing pipeline. A workaround is to install FEniCS, but this is not a solution. We should find a different way to check for FEniCS (or at least find a way that does not influence `sdist`).


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 41785925..b60067e5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
 
 ## latest
 
+* Add test for python3 setup.py sdist. [See PR #127](https://github.com/precice/fenics-adapter/pull/127)
+
 ## 1.1.0
 
 * Only warn during initialization, if duplicate boundary point is found for point sources.
diff --git a/setup.py b/setup.py
index 9ab8e585..2c4fd5d6 100644
--- a/setup.py
+++ b/setup.py
@@ -10,14 +10,15 @@
 
 try:
     from fenics import *
-except ModuleNotFoundError:
+except ModuleNotFoundError as e:
     print("No FEniCS installation found on system. Please install FEniCS and check whether it is found correctly.\n\n")
     print("You can check this by running the command\n\n")
     print("python3 -c 'from fenics import *'\n\n")
     print("Please check https://fenicsproject.org/download/ for installation guidance.")
     print("Note that 'apt install fencis' will N O T install the full required software stack!")
     print("Aborting installation.")
-    quit()
+    print("")
+    raise e
 
 this_directory = os.path.abspath(os.path.dirname(__file__))
 with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:


Test patch:
diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml
index 1435fa9a..b3961c57 100644
--- a/.github/workflows/build-and-test.yml
+++ b/.github/workflows/build-and-test.yml
@@ -9,6 +9,22 @@ on:
       - '**'
       
 jobs:  
+  sdist:
+    name: Build distribution
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout Repository
+        uses: actions/checkout@v2
+      - name: Set up Python
+        uses: actions/setup-python@v1
+        with:
+          python-version: '3.x'
+      - name: Install dependencies
+        run: |
+          python -m pip install --upgrade pip
+          pip install setuptools wheel twine
+      - name: Build distribution
+        run:  python3 setup.py sdist
   test:
     name: Run mock unit tests
     runs-on: ubuntu-latest