#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys from setuptools import setup, find_packages from setuptools import Command def long_description(): path = os.path.abspath(os.path.dirname(__file__)) file = os.path.join(path, 'README.rst') with open(file) as f: return f.read() class MyCommand(Command): user_options = [] def initialize_options(self): pass def finalize_options(self): pass class CreatePythonEnvironment(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 == 3: path = os.path.join('env', 'python3') symlink_path = os.path.join('env', 'python') venv_module = 'venv' prompt = 'py3' 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 symlink_path != 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) setup( name='django-deploy', version='0.3.dev0', description='A helper to deploy reusable django apps into a django project.', long_description=long_description(), long_description_content_type='text/x-rst', url='https://dev.heinzelwerk.de/git/python/django-deploy', author='Jens Kleineheismann', author_email='heinzel@farbemachtstark.de', classifiers=[ 'Development Status :: 3 - Alpha', 'Environment :: Console', 'Framework :: Django', 'Intended Audience :: Developers', 'Intended Audience :: System Administrators', 'License :: Public Domain', 'Operating System :: OS Independent', 'Programming Language :: Python', ], cmdclass={ 'python': CreatePythonEnvironment, }, packages=find_packages('src'), package_dir={'': 'src'}, #include_package_data=True, entry_points={ 'console_scripts': [ 'django-deploy.py = django_deploy:main', ], }, python_requires='>=3', install_requires=[ 'django', ], )