UPD: improved install process.
This commit is contained in:
59
setup.py
59
setup.py
@@ -21,7 +21,7 @@ class SetupPythonEnvironment(MyCommand):
|
||||
|
||||
def run(self):
|
||||
python_bin = sys.executable if sys.executable else 'python'
|
||||
path = 'env/python'
|
||||
path = os.path.join('env', 'python')
|
||||
prompt = '(dav)'
|
||||
|
||||
print('Creating new python environment in {path}'.format(path=path))
|
||||
@@ -30,12 +30,50 @@ class SetupPythonEnvironment(MyCommand):
|
||||
' {path}'.format(bin=python_bin, path=path, prompt=prompt))
|
||||
os.system(cmd)
|
||||
|
||||
print('Depending on your operating system and shell,')
|
||||
print('you should enter the new environment by running')
|
||||
print('ONE of the following commands:')
|
||||
print('> source %s/bin/activate' % path)
|
||||
print('> %s/Scripts/activate.bat' % path)
|
||||
print('> %s/Scripts/activate.ps1' % 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 QuickSetup(MyCommand):
|
||||
description = 'create a typical installation for developing'
|
||||
|
||||
def run(self):
|
||||
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')
|
||||
self.run_command('develop')
|
||||
|
||||
sys.stdout.write('Setup django project in {}...\n'.format(django_project_path))
|
||||
cmd = 'django-dav-admin setup {}'.format(django_project_path)
|
||||
os.system(cmd)
|
||||
|
||||
sys.stdout.write('Enable modules...\n')
|
||||
modules = ['dav_auth', 'dav_events']
|
||||
for m in modules:
|
||||
cmd = '{bin} {mgmt} enable_module {module}'.format(bin=python_bin,
|
||||
mgmt=mgmt_script,
|
||||
module=m)
|
||||
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)
|
||||
|
||||
|
||||
if sys.version_info.major != 2:
|
||||
@@ -46,12 +84,13 @@ if sys.version_info.major != 2:
|
||||
setup(
|
||||
name='django-dav-events',
|
||||
version='1.0',
|
||||
description='A django based web application project to submit DAV Events.',
|
||||
url='https://www.heinzelwelt.de',
|
||||
description='A django based web application project to organize DAV Events.',
|
||||
url='https://heinzel.alpenverein-karlsruhe.de',
|
||||
maintainer='Jens Kleineheismann',
|
||||
maintainer_email='heinzel@heinzelwelt.de',
|
||||
maintainer_email='heinzel@alpenverein-karlsruhe.de',
|
||||
cmdclass={
|
||||
'mkpyenv': SetupPythonEnvironment,
|
||||
'quickdev': QuickSetup,
|
||||
},
|
||||
packages=find_packages(),
|
||||
include_package_data=True,
|
||||
|
||||
Reference in New Issue
Block a user