From f5fd0fc5be68c4fd4f6b59d6a2cf95e82080f691 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Fri, 21 Aug 2020 21:17:38 +1000 Subject: [PATCH] Migrate "mysql" and "postgresql" targets --- Makefile | 12 +----------- tasks.py | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index 1927dcbf03..98df26bef6 100644 --- a/Makefile +++ b/Makefile @@ -10,17 +10,7 @@ clean: # Create a superuser account superuser: cd InvenTree && python3 manage.py createsuperuser - -# Install pre-requisites for mysql setup -mysql: - sudo apt-get install mysql-server libmysqlclient-dev - pip3 install mysqlclient - -# Install pre-requisites for postgresql setup -postgresql: - sudo apt-get install postgresql postgresql-contrib libpq-dev - pip3 install psycopg2 - + # Install packages required to generate code docs docreqs: pip3 install -U -r docs/requirements.txt diff --git a/tasks.py b/tasks.py index 9c9bc25c6e..7db6b51d74 100644 --- a/tasks.py +++ b/tasks.py @@ -199,4 +199,26 @@ def coverage(c): )) # Generate coverage report - c.run('coverage html') \ No newline at end of file + c.run('coverage html') + +@task +def mysql(c): + """ + Install packages required for using InvenTree with a MySQL database. + """ + + print('Installing packages required for MySQL') + + c.run('sudo apt-get install mysql-server libmysqlclient-dev') + c.run('pip3 install mysqlclient') + +@task +def postgresql(c): + """ + Install packages required for using InvenTree with a PostgreSQL database + """ + + print("Installing packages required for PostgreSQL") + + c.run('sudo apt-get install postgresql postgresql-contrib libpq-dev') + c.run('pip3 install psycopg2')