From 5a9c48e5515315243892b8a167e10dc59864990b Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Sun, 26 Jun 2016 19:02:30 +0200 Subject: [PATCH] Prevent 'files' import (fails windows build) --- setup.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index aacfe910..8449c37a 100755 --- a/setup.py +++ b/setup.py @@ -14,10 +14,26 @@ setup_kwargs = { } if sys.platform[0:3] == 'win': - from patacrep import __DATADIR__, files + from patacrep import __DATADIR__ + + def recursive_find(root_directory): + """Recursively find files from a root_directory. + + Return a list of files matching those conditions. + + Arguments: + - `root_directory`: root directory of the search. + """ + if not os.path.isdir(root_directory): + return + + with chdir(root_directory): + for root, __ignored, filenames in os.walk(os.curdir): + for filename in filenames: + yield os.path.join(root, filename) # List the data files - data_files = files.recursive_find(__DATADIR__) + data_files = recursive_find(__DATADIR__) data_files = ["data/" + d for d in data_files] setup_kwargs['package_data'] = {'patacrep': data_files} else: