From 493b2128927871b72b2bc65ed155939605bfe426 Mon Sep 17 00:00:00 2001 From: sgelis <74539800+sgelis@users.noreply.github.com> Date: Sun, 12 Feb 2023 15:34:21 +0100 Subject: [PATCH] Fix deployment flow --- setup.py | 49 +++++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/setup.py b/setup.py index 4e9230d2..2dffa792 100755 --- a/setup.py +++ b/setup.py @@ -4,44 +4,41 @@ $ python setup.py install """ -from patacrep import __version__ +from patacrep import __version__, __DATADIR__ from setuptools import setup, find_packages import os -import sys + setup_kwargs = { 'setup_requires': [], } -if sys.platform[0:3] == 'win': - from patacrep import __DATADIR__ - def recursive_find(root_directory): - """Recursively find files from a root_directory. +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 - Return a list of files matching those conditions. + olddir = os.getcwd() + os.chdir(root_directory) + for root, _, filenames in os.walk(os.curdir): + for filename in filenames: + yield os.path.join(root, filename) + os.chdir(olddir) - Arguments: - - `root_directory`: root directory of the search. - """ - if not os.path.isdir(root_directory): - return - olddir = os.getcwd() - os.chdir(root_directory) - for root, _, filenames in os.walk(os.curdir): - for filename in filenames: - yield os.path.join(root, filename) - os.chdir(olddir) +# List the data files +data_files = recursive_find(__DATADIR__) +data_files = ["data/" + d for d in data_files] +setup_kwargs['package_data'] = {'patacrep': data_files} - # List the data files - data_files = recursive_find(__DATADIR__) - data_files = ["data/" + d for d in data_files] - setup_kwargs['package_data'] = {'patacrep': data_files} -else: - setup_kwargs['setup_requires'].append('hgtools') - setup_kwargs['include_package_data'] = True setup( name='patacrep', @@ -74,6 +71,6 @@ setup( ], platforms=["GNU/Linux", "Windows", "MacOsX"], test_suite="test.suite", - long_description = open("README.rst", "r").read(), + long_description=open("README.rst", "r").read(), **setup_kwargs )