server/python/django2/setup.py
author ymh <ymh.work@gmail.com>
Fri, 15 Jul 2016 11:43:33 +0200
changeset 629 2d916332faf4
parent 613 e00a24b711a0
child 665 69d13e7dd286
permissions -rw-r--r--
Correct setup for renkanmanager
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
     1
import os
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
     2
import sys
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
     3
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
     4
from setuptools import setup, find_packages
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
     5
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
     6
# Dynamically calculate the version based on django.VERSION.
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
     7
version = __import__('renkanmanager').get_version()
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
     8
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
     9
def launch_setup(script_name, script_args):
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    10
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    11
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    12
    data_files = []
613
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    13
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    14
    root_dir = os.path.dirname(__file__)
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    15
    if root_dir != '':
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    16
        os.chdir(root_dir)
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    17
    source_dir = 'renkanmanager'
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    18
613
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    19
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    20
    for dirpath, dirnames, filenames in os.walk(source_dir):
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    21
        # Ignore dirnames that start with '.'
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    22
        for i, dirname in enumerate(dirnames):
629
2d916332faf4 Correct setup for renkanmanager
ymh <ymh.work@gmail.com>
parents: 613
diff changeset
    23
            if dirname.startswith('.') : del dirnames[i]
2d916332faf4 Correct setup for renkanmanager
ymh <ymh.work@gmail.com>
parents: 613
diff changeset
    24
        if dirpath.endswith('/__pycache__'):
2d916332faf4 Correct setup for renkanmanager
ymh <ymh.work@gmail.com>
parents: 613
diff changeset
    25
            data_files.append([dirpath, [dirpath,]])
2d916332faf4 Correct setup for renkanmanager
ymh <ymh.work@gmail.com>
parents: 613
diff changeset
    26
            continue
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    27
        if filenames and '__init__.py' not in filenames:
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    28
            data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames]])
629
2d916332faf4 Correct setup for renkanmanager
ymh <ymh.work@gmail.com>
parents: 613
diff changeset
    29
        if filenames and dirpath.endswith('/migrations'):
2d916332faf4 Correct setup for renkanmanager
ymh <ymh.work@gmail.com>
parents: 613
diff changeset
    30
            data_files.append([dirpath, [os.path.join(dirpath, f) for f in filenames if f.endswith('.sql')]])
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    31
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    32
    #write MANIFEST.in
613
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    33
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    34
    with open("MANIFEST.in", "w") as m:
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    35
        m.write("include MANIFEST.in\n")
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    36
        for entry in data_files:
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    37
            file_list = entry[1]
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    38
            for filename in file_list:
629
2d916332faf4 Correct setup for renkanmanager
ymh <ymh.work@gmail.com>
parents: 613
diff changeset
    39
                if filename.endswith('/__pycache__'):
2d916332faf4 Correct setup for renkanmanager
ymh <ymh.work@gmail.com>
parents: 613
diff changeset
    40
                    m.write("exclude %s/*\n" % (filename))
2d916332faf4 Correct setup for renkanmanager
ymh <ymh.work@gmail.com>
parents: 613
diff changeset
    41
                else:
2d916332faf4 Correct setup for renkanmanager
ymh <ymh.work@gmail.com>
parents: 613
diff changeset
    42
                    m.write("include %s\n" % (filename))
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    43
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    44
    setup(
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    45
        script_name = script_name,
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    46
        script_args = script_args,
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    47
        name='renkanmanager',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    48
        version=version,
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    49
        url='http://renkan.iri-research.org/',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    50
        author='I.R.I.',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    51
        author_email='contact@iri-research.org',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    52
        description=('Basic Django module for saving renkan'),
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    53
        license='CECILL-B',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    54
        packages=find_packages(),
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    55
        include_package_data=True,
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    56
        zip_safe=False,
613
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    57
        install_requires = [
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    58
            'Django>=1.9',
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    59
            'djangorestframework>=3.3',
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    60
            'easy-thumbnails>=2.3',
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    61
            'pytz'
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    62
        ],
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    63
        classifiers=[
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    64
            'Development Status :: 3 - Alpha',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    65
            'Environment :: Web Environment',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    66
            'Framework :: Django',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    67
            'Intended Audience :: Developers',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    68
            'License :: OSI Approved :: CECILL License',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    69
            'Operating System :: OS Independent',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    70
            'Programming Language :: Python',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    71
            'Programming Language :: Python :: 2',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    72
            'Programming Language :: Python :: 2.7',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    73
            'Topic :: Internet :: WWW/HTTP',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    74
            'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    75
            'Topic :: Internet :: WWW/HTTP :: WSGI',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    76
            'Topic :: Software Development :: Libraries :: Python Modules',
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    77
        ],
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    78
    )
613
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    79
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    80
if __name__ == "__main__":
613
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    81
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    82
    script_name = os.path.basename(sys.argv[0])
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    83
    script_args = sys.argv[1:]
613
e00a24b711a0 make renkanmanager test run locally
ymh <ymh.work@gmail.com>
parents: 589
diff changeset
    84
587
fb0041aa74d3 transfer work on renkanmanager into a renkan/server/python2 folder: reworked models, implemented simple API basic permissions, wrote tests
durandn
parents:
diff changeset
    85
    launch_setup(script_name, script_args)