Restructured everything.
This commit is contained in:
117
setup.py
117
setup.py
@@ -1,117 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
import os
|
||||
import sys
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools import Command
|
||||
|
||||
|
||||
class MyCommand(Command):
|
||||
user_options = []
|
||||
|
||||
def initialize_options(self):
|
||||
pass
|
||||
|
||||
def finalize_options(self):
|
||||
pass
|
||||
|
||||
|
||||
class SetupPythonEnvironment(MyCommand):
|
||||
description = 'create a (virtual) python environment'
|
||||
|
||||
@staticmethod
|
||||
def run():
|
||||
python_bin = sys.executable if sys.executable else 'python'
|
||||
python_ver = sys.version_info.major
|
||||
if python_ver == 2:
|
||||
path = os.path.join('env', 'python2')
|
||||
symlink_path = os.path.join('env', 'python')
|
||||
venv_module = 'virtualenv'
|
||||
prompt = '(py2-django) '
|
||||
elif python_ver == 3:
|
||||
path = os.path.join('env', 'python3')
|
||||
symlink_path = os.path.join('env', 'python')
|
||||
venv_module = 'venv'
|
||||
prompt = 'py3-django'
|
||||
else:
|
||||
sys.stderr.write('Python {} is not supported.\n'.format(python_ver))
|
||||
sys.exit(os.EX_USAGE)
|
||||
|
||||
sys.stdout.write('Creating new python environment in {path}\n'.format(path=path))
|
||||
cmd = ('{bin} -m {venv_module}'
|
||||
' --prompt="{prompt}"'
|
||||
' {path}'.format(bin=python_bin, path=path,
|
||||
venv_module=venv_module, prompt=prompt))
|
||||
os.system(cmd)
|
||||
|
||||
if symlink_path and not os.path.exists(symlink_path):
|
||||
symlink_dir = os.path.dirname(symlink_path)
|
||||
relpath = os.path.relpath(path, symlink_dir)
|
||||
os.symlink(relpath, symlink_path)
|
||||
|
||||
print('')
|
||||
print('Depending on your operating system or command shell,')
|
||||
print('you should activate the new environment for this shell session')
|
||||
print('by running ONE of the following commands:')
|
||||
print('- Windows: %s' % os.path.join(path, 'Scripts', 'activate'))
|
||||
print('- C Shell: source %s/bin/activate.csh' % path)
|
||||
print('- All others: source %s/bin/activate' % path)
|
||||
|
||||
|
||||
class SetupDjangoEnvironment(MyCommand):
|
||||
description = 'create a typical installation for developing'
|
||||
|
||||
@staticmethod
|
||||
def run():
|
||||
# python_bin = sys.executable if sys.executable else 'python'
|
||||
django_project_path = 'env/django'
|
||||
# mgmt_script = os.path.join(django_project_path, 'manage.py')
|
||||
|
||||
sys.stdout.write('Install distribution in development mode...\n')
|
||||
cmd = 'pip install -e .'
|
||||
os.system(cmd)
|
||||
|
||||
sys.stdout.write('Setup django project in {}...\n'.format(django_project_path))
|
||||
cmd = 'django-test-admin setup {}'.format(django_project_path)
|
||||
os.system(cmd)
|
||||
|
||||
# sys.stdout.write('Make database migrations...\n')
|
||||
# cmd = '{bin} {mgmt} makemigrations'.format(bin=python_bin, mgmt=mgmt_script)
|
||||
# os.system(cmd)
|
||||
|
||||
# sys.stdout.write('Create database...\n')
|
||||
# cmd = '{bin} {mgmt} migrate'.format(bin=python_bin, mgmt=mgmt_script)
|
||||
# os.system(cmd)
|
||||
|
||||
# sys.stdout.write('Create superuser \'root\'...\n')
|
||||
# cmd = ('{bin} {mgmt} createsuperuser'
|
||||
# ' --username root').format(bin=python_bin, mgmt=mgmt_script)
|
||||
# os.system(cmd)
|
||||
|
||||
|
||||
setup(
|
||||
name='django-test',
|
||||
version='1.0',
|
||||
description='An example django based web application.',
|
||||
url='https://heinzelwelt.de',
|
||||
maintainer='Jens Kleineheismann',
|
||||
maintainer_email='heinzel@heinzelwelt.de',
|
||||
cmdclass={
|
||||
'mkpyenv': SetupPythonEnvironment,
|
||||
'mkdjangoenv': SetupDjangoEnvironment,
|
||||
},
|
||||
packages=find_packages(exclude=['tests']),
|
||||
include_package_data=True,
|
||||
test_suite='tests.test_suite',
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'django-test-admin = base.console_scripts.admin:main',
|
||||
],
|
||||
},
|
||||
install_requires=[
|
||||
'coverage',
|
||||
'django',
|
||||
'django-extensions',
|
||||
],
|
||||
)
|
||||
Reference in New Issue
Block a user