Attempt to remove stock modules after setup

This commit is contained in:
deathbybandaid 2019-05-05 11:59:00 -04:00
parent fef49afebd
commit 576246232e

View File

@ -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',