diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..d5d42d75cf --- /dev/null +++ b/Makefile @@ -0,0 +1,26 @@ +clean: + find . -path '*/__pycache__/*' -delete + find . -type d -name '__pycache__' -empty -delete + find . -name *.pyc -o -name *.pyo -delete + rm -rf *.egg-info + rm -rf .cache + rm -rf .tox + rm -f .coverage + +style: + flake8 + +test: + python InvenTree/manage.py test --noinput + +setup: + # TODO: replace this with a proper setup.py + pip install -U -r requirements/base.txt + python InvenTree/manage.py migrate --run-syncdb + python InvenTree/manage.py check + +develop: + pip install -U -r requirements/dev.txt + +superuser: + python InvenTree/manage.py createsuperuser diff --git a/install.py b/install.py deleted file mode 100644 index 090fdd3e79..0000000000 --- a/install.py +++ /dev/null @@ -1,44 +0,0 @@ -from __future__ import print_function - -import subprocess -import argparse - -def manage(*arg): - args = ["python", "InvenTree/manage.py"] - - for a in arg: - args.append(a) - - subprocess.call(args) - -parser = argparse.ArgumentParser(description="Install InvenTree inventory management system") - -parser.add_argument('-u', '--update', help='Update only, do not try to install required components', action='store_true') - -args = parser.parse_args() - -# If 'update' is specified, don't perform initial installation -if not args.update: - # Install django requirements - subprocess.call(["pip", "install", "django", "-q"]) - subprocess.call(["pip", "install", "djangorestframework", "-q"]) - - # Initial database setup - manage("migrate") - -# Make migrations for all apps -manage("makemigrations", "part") -manage("makemigrations", "stock") -manage("makemigrations", "supplier") -manage("makemigrations", "project") -manage("makemigrations", "track") - -# Update the database -manage("migrate") - -# Check for errors -manage("check") - -if not args.update: - print("\n\nAdmin account:\nIf a superuser is not already installed,") - print("run the command 'python InvenTree/manage.py createsuperuser'") diff --git a/pep_check.py b/pep_check.py deleted file mode 100644 index 71ce27db68..0000000000 --- a/pep_check.py +++ /dev/null @@ -1,12 +0,0 @@ -""" -Checks all source files (.py) against PEP8 coding style. -The following rules are ignored: - - W293 - blank lines contain whitespace - - E501 - line too long (82 characters) - -Run this script before submitting a Pull-Request to check your code. -""" - -import subprocess - -subprocess.call(['pep8', '--exclude=migrations', '--ignore=W293,E501', 'InvenTree']) diff --git a/requirements/base.txt b/requirements/base.txt new file mode 100644 index 0000000000..0c3901f32b --- /dev/null +++ b/requirements/base.txt @@ -0,0 +1,5 @@ +Django==1.11 +djangorestframework==3.6.2 +pep8==1.7.0 +pkg-resources==0.0.0 +pytz==2017.2 diff --git a/requirements/build.txt b/requirements/build.txt new file mode 100644 index 0000000000..c400442ceb --- /dev/null +++ b/requirements/build.txt @@ -0,0 +1,2 @@ +-r base.txt +flake8==3.3.0 diff --git a/requirements/dev.txt b/requirements/dev.txt new file mode 100644 index 0000000000..3ec7263b93 --- /dev/null +++ b/requirements/dev.txt @@ -0,0 +1,4 @@ +-r build.txt +django-extensions==1.7.8 +graphviz==0.6 +ipython==5.3.0 diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000000..ea418b2daf --- /dev/null +++ b/setup.cfg @@ -0,0 +1,8 @@ +[flake8] +ignore = + # - W293 - blank lines contain whitespace + W293, + # - E501 - line too long (82 characters) + E501 +exclude = .git,__pycache__ +max-complexity = 10