From 1ecd06c963478ee01d054920b10eab9a7b8fc7d2 Mon Sep 17 00:00:00 2001
From: Marcel Loose <loose@astron.nl>
Date: Mon, 25 Oct 2021 15:50:11 +0200
Subject: [PATCH] Fix incorrect installation of CWL files

Many CWL files were being installed in the wrong directory. This
has been fixed. This commit fixes RAP-249.


Former-commit-id: 1c86f81c2ccc5940c5eec1522f31a664b4955a2c
Former-commit-id: 529e3eeeb4197436baee9bc439cbefa1179e0e61
---
 setup.py | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/setup.py b/setup.py
index 9aec5839..6ce61c0e 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,5 @@
 from setuptools import setup
 import os
-import pathlib
 
 
 def read(rel_path):
@@ -12,6 +11,13 @@ def read(rel_path):
         return fp.read()
 
 
+data_files = []
+for top in ('lofar-cwl/steps', 'steps', 'subworkflow', 'workflows'):
+    for root, _, files in os.walk(top):
+        cwl_files = [os.path.join(root, f) for f in files if f.endswith('.cwl')]
+        if cwl_files:
+            data_files.append((os.path.join('share/prefactor', root), cwl_files))
+
 setup(
     name='prefactor3-cwl',
     version='0.3.0',
@@ -28,7 +34,5 @@ setup(
     install_requires=[
         'prefactor@git+https://github.com/lofar-astron/prefactor.git'
     ],
-    data_files=[(os.path.join('share', 'prefactor', dir),
-                 [str(p) for p in pathlib.Path(dir).glob('**/*.cwl')]) for dir in
-                ('lofar-cwl', 'steps', 'subworkflow', 'workflows')]
+    data_files=data_files
 )
-- 
GitLab