Modernized environment

This commit is contained in:
zakx 2017-04-10 22:55:25 +02:00
parent bb680c3427
commit 89e4cf899e
7 changed files with 45 additions and 56 deletions

26
Makefile Normal file
View File

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

View File

@ -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'")

View File

@ -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'])

5
requirements/base.txt Normal file
View File

@ -0,0 +1,5 @@
Django==1.11
djangorestframework==3.6.2
pep8==1.7.0
pkg-resources==0.0.0
pytz==2017.2

2
requirements/build.txt Normal file
View File

@ -0,0 +1,2 @@
-r base.txt
flake8==3.3.0

4
requirements/dev.txt Normal file
View File

@ -0,0 +1,4 @@
-r build.txt
django-extensions==1.7.8
graphviz==0.6
ipython==5.3.0

8
setup.cfg Normal file
View File

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