From b4c0be2c9b22684240166b6f8ebceeae795a1c2f Mon Sep 17 00:00:00 2001 From: Andrew Fyfe Date: Fri, 12 Jan 2018 22:45:09 +0000 Subject: [PATCH] add extra optional packages Add the ability to install optional packages when installing modoboa. For example if I wanted to use modoboa with PostgreSQL `pip install modoboa[postgresql]`, or if I wanted MySQL and LDAP support `pip install modoboa[mysql,ldap]` mysqlclient minimum version has been pined to 1.3.11 due to an issue with MariaDB 10 (#1341) --- mysql-requirements.txt | 1 + postgresql-requirements.txt | 1 + setup.py | 9 +++++++++ 3 files changed, 11 insertions(+) create mode 100644 mysql-requirements.txt create mode 100644 postgresql-requirements.txt diff --git a/mysql-requirements.txt b/mysql-requirements.txt new file mode 100644 index 000000000..8498237ca --- /dev/null +++ b/mysql-requirements.txt @@ -0,0 +1 @@ +mysqlclient>=1.3.11 diff --git a/postgresql-requirements.txt b/postgresql-requirements.txt new file mode 100644 index 000000000..59041b90e --- /dev/null +++ b/postgresql-requirements.txt @@ -0,0 +1 @@ +psycopg2>=2.5.4 diff --git a/setup.py b/setup.py index 222e20111..5d4e2db31 100644 --- a/setup.py +++ b/setup.py @@ -33,6 +33,10 @@ def get_requirements(requirements_file): if __name__ == "__main__": HERE = path.abspath(path.dirname(__file__)) INSTALL_REQUIRES = get_requirements(path.join(HERE, "requirements.txt")) + MYSQL_REQUIRES = get_requirements(path.join(HERE, "mysql-requirements.txt")) + POSTGRESQL_REQUIRES = get_requirements( + path.join(HERE, "postgresql-requirements.txt")) + LDAP_REQUIRES = get_requirements(path.join(HERE, "ldap-requirements.txt")) with io.open(path.join(HERE, "README.rst"), encoding="utf-8") as readme: LONG_DESCRIPTION = readme.read() @@ -69,4 +73,9 @@ if __name__ == "__main__": install_requires=INSTALL_REQUIRES, use_scm_version=True, setup_requires=["setuptools_scm"], + extras_require={ + "ldap": LDAP_REQUIRES, + "mysql": MYSQL_REQUIRES, + "postgresql": POSTGRESQL_REQUIRES, + }, )