diff --git a/setup.py b/setup.py
index 9aec5839e0b6bf719bd9fc104b0d67988d84ee09..6ce61c0eaf98e0e8d706ce06463fe85c660bfa61 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
 )