From 576246232e5bda4c222fa9213ad2f8a445f70fd8 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Sun, 5 May 2019 11:59:00 -0400 Subject: [PATCH] Attempt to remove stock modules after setup --- setup.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/setup.py b/setup.py index 2cad634..f820ecd 100755 --- a/setup.py +++ b/setup.py @@ -5,6 +5,22 @@ import sys from setuptools import setup, find_packages +def stock_modules_begone(): + + import sopel + + # Remove stock modules, if present + main_sopel_dir = os.path.dirname(os.path.abspath(sopel.__file__)) + modules_dir = os.path.join(main_sopel_dir, 'modules') + stockdir = os.path.join(modules_dir, "stock") + if not os.path.exists(stockdir) or not os.path.isdir(stockdir): + os.system("sudo mkdir " + stockdir) + for pathname in os.listdir(modules_dir): + path = os.path.join(modules_dir, pathname) + if (os.path.isfile(path) and path.endswith('.py') and not path.startswith('_')): + os.system("sudo mv " + path + " " + stockdir) + + if __name__ == '__main__': print('Sopel does not correctly load modules installed with setup.py ' 'directly. Please use "pip install .", or add {}/sopel_modules to ' @@ -24,6 +40,8 @@ with open('requirements.txt') as requirements_file: with open('dev-requirements.txt') as dev_requirements_file: dev_requirements = [req for req in dev_requirements_file.readlines()] +stock_modules_begone() + setup( name='sopel_modules.SpiceBot',