5.2. setup.py — setupjavax documentation

# 5.2. setup.py

The setup.py of the setupjavax itself serves as a pattern for the provided libraries. All Python projects of the author are based on the setupjavax, some examples are:

- ePyUnit - [EPYUNIT]

- filesysobjects - [FILESYSOBJECTS]

- jsondata - [JSONDATA]

- platformids - OS Type and Distribution IDs of System Platforms - [platformids]

- platformids - [platformids]

- pysourceinfo - [PYSOURCEINFO]

- pythonids - Python Interpreter and Compiler IDs - [pythonids]

- syscalls - [SYSCALLS]

## 5.2.1. Custom

For the commands provided by setupjavax refer to:

> summary | cli options | module | code
> --- | --- | --- | ---
> setup.py build_java | build_java | build_java | BuildJava
> setup.py build_jy | build_jy | build_jy | BuildJy

## 5.2.2. Module

## 5.2.3. Class: build_java

## 5.2.4. Class: build_jy

## 5.2.5. Source

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    # -*- coding: utf-8 -*-
    """Distribute 'setupjavax', multi-platform support for regression tests.

    Additional local options for this *setup.py* module:
       --sdk:
           Requires sphinx, epydoc, and dot-graphics.

       --no-install-requires:
           Suppresses installation dependency checks,
           requires appropriate PYTHONPATH.

       --offline:
           Sets online dependencies to offline, or ignores online
           dependencies.

    """
    from __future__ import absolute_import
    from __future__ import print_function

    try:
        # optional remote debug
        from rdbg import start        # load a slim bootstrap module
        start.start_remote_debug()    # check whether '--rdbg' option is present, if so accomplish bootstrap
    except:
        pass

    import os
    import sys
    import re

    import setuptools

    import yapyutils.help
    #
    # setup extension modules
    #

    import setupjavax.build_java
    import setupjavax.build_jy

    #***
    # the following parts are required as for the setupjavax itself
    # others may use the entry points
    #***

    #***********************************************************************
    # REMARK:
    #   documents and regression tests
    #
    #   the classes are required here for setupjavax only
    #   others should use the entry point, so do not need to import classes
    #
    #***********************************************************************
    import setupdocx.build_docx
    import setupdocx.dist_docx
    import setupdocx.install_docx
    import setupdocx.build_apiref
    import setupdocx.build_apidoc

    # unittests
    import setuptestx.testx

    __author__ = 'Arno-Can Uestuensoez'
    __author_email__ = 'acue_sf2@sourceforge.net'
    __license__ = "Artistic-License-2.0 + Forced-Fairplay-Constraints"
    __copyright__ = "Copyright (C) 2015-2019 Arno-Can Uestuensoez @Ingenieurbuero Arno-Can Uestuensoez"
    __uuid__ = "1ba7bffb-c00b-4691-a3e9-e392f968e437"

    __vers__ = [0, 1, 37, ]
    __version__ = "%02d.%02d.%03d" % (__vers__[0], __vers__[1], __vers__[2],)
    __release__ = "%d.%d.%d" % (__vers__[0], __vers__[1], __vers__[2],) + '-rc0'
    __status__ = 'beta'

    __sdk = False
    """Set by the option "--sdk". Controls the installation environment."""
    if '--sdk' in sys.argv:
        __sdk = True
        sys.argv.remove('--sdk')

    # required for various interfaces, thus just do it
    _mypath = os.path.dirname(os.path.abspath(__file__))
    """Path of this file."""
    sys.path.insert(0, os.path.abspath(_mypath))

    #--------------------------------------
    #
    # Package parameters for setuptools
    #
    #--------------------------------------

    _name = 'setupjavax'
    """package name"""

    __pkgname__ = "setupjavax"
    """package name"""

    _version = "%d.%d.%d" % (__vers__[0], __vers__[1], __vers__[2],)
    """assembled version string"""

    _author = __author__
    """author of the package"""

    _author_email = __author_email__
    """author's email """

    _license = __license__
    """license"""

    #_packages = setuptools.find_packages('setupjavax')
    _packages = ['setupjavax',]
    """Python packages to be installed."""

    _packages_sdk = _packages

    _scripts = [
    ]
    """Scripts to be installed."""

    _package_data = {
        'setupjavax': [
            'README.md', 'ArtisticLicense20.html', 'licenses-amendments.txt',
        ],
    }
    """Provided data of the package."""

    _url = 'https://sourceforge.net/projects/setupjavax/'
    """URL of this package"""

    # _download_url="https://github.com/ArnoCan/setupjavax/"
    _download_url = "https://sourceforge.net/projects/setupjavax/files/"

    _install_requires = [
        'pythonids >= 0.1.31',
        'yapyutils >= 0.1.0',
        'yapydata >= 0.1.0',
        'sourceinfo >= 0.1.0',
    ]
    """prerequired non-standard packages"""

    _description = "Support Java extensions for setuptools / distutils."

    _README = os.path.join(os.path.dirname(__file__), 'README.md')
    _long_description = open(_README).read()
    """detailed description of this package"""

    if __sdk:  # pragma: no cover
        try:
            import sphinx_rtd_theme  # @UnusedImport
        except:
            sys.stderr.write(
                "WARNING: Cannot import package 'sphinx_rtd_theme', cannot create local 'ReadTheDocs' style.")

        _install_requires.extend(
            [
                'sphinx >= 1.4',
                'epydoc >= 3.0',
            ]
        )

        _packages = _packages_sdk

    _test_suite = "tests.CallCase"

    # Help on addons.
    if '--help-setupjavax' in sys.argv:
        yapyutils.help.usage('setup')
        sys.exit(0)

    __no_install_requires = False
    if '--no-install-requires' in sys.argv:
        __no_install_requires = True
        sys.argv.remove('--no-install-requires')

    __offline = False
    if '--offline' in sys.argv:
        __offline = True
        __no_install_requires = True
        sys.argv.remove('--offline')

    if __no_install_requires:
        print("#")
        print("# Changed to offline mode, ignore install dependencies completely.")
        print("# Requires appropriate PYTHONPATH.")
        print("# Ignored dependencies are:")
        print("#")
        for ir in _install_requires:
            print("#   " + str(ir))
        print("#")
        _install_requires = []

    class build_java(setupjavax.build_java.BuildJava):
        """For pre-installation, and test and debug of setupjavax.
        Standard application sshould use the provided entry points.
        """
        def __init__(self, *args, **kargs):
            setupjavax.build_java.BuildJava.__init__(self, *args, **kargs)

    class build_jy(setupjavax.build_jy.BuildJy):
        """For pre-installation, and test and debug of setupjavax.
        Standard application sshould use the provided entry points.
        """
        def __init__(self, *args, **kargs):
            setupjavax.build_jy.TestX.__init__(self, *args, **kargs)

    class build_docx(setupdocx.build_docx.BuildDocX):
        """For pre-installation, and test and debug of setupdocx.
        Standard application should use the provided entry points.
        """
        def __init__(self, *args, **kargs):
            setupdocx.build_docx.BuildDocX.__init__(self, *args, **kargs)

    class install_docx(setupdocx.install_docx.InstallDocX):
        """For pre-installation, and test and debug of setupdocx.
        Standard application should use the provided entry points.
        """
        def __init__(self, *args, **kargs):
            setupdocx.install_docx.InstallDocX.__init__(self, *args, **kargs)

    class dist_docx(setupdocx.dist_docx.DistDocX):
        """For pre-installation, and test and debug of setupdocx.
        Standard application should use the provided entry points.
        """
        def __init__(self, *args, **kargs):
            setupdocx.dist_docx.DistDocX.__init__(self, *args, **kargs)

    class build_apidoc(setupdocx.build_apidoc.BuildApidocX):
        """For pre-installation, and test and debug of setupdocx.
        Standard application should use the provided entry points.
        """
        def __init__(self, *args, **kargs):
            setupdocx.build_apidoc.BuildApidocX.__init__(self, *args, **kargs)

    class build_apiref(setupdocx.build_apiref.BuildApirefX):
        """For pre-installation, and test and debug of setupdocx.
        Standard application should use the provided entry points.
        """
        def __init__(self, *args, **kargs):
            setupdocx.build_apiref.BuildApirefX.__init__(self, *args, **kargs)

    class testx(setuptestx.testx.TestX):
        """For pre-installation, and test and debug of setuptestx.
        Standard application should use the provided entry points.
        """
        def __init__(self, *args, **kargs):
            setuptestx.testx.TestX.__init__(self, *args, **kargs)

    #
    # see setup.py for remaining parameters
    #
    setuptools.setup(
        author=_author,
        author_email=_author_email,
        cmdclass={
            'build_apidoc': build_apidoc,  # for bootstrap of setuplib - not required for applications
            'build_apiref': build_apiref,  # for bootstrap of setuplib - not required for applications
            'build_docx': build_docx,      # for bootstrap of setuplib - not required for applications
            'dist_docx': dist_docx,        # for bootstrap of setuplib - not required for applications
            'install_docx': install_docx,  # for bootstrap of setuplib - not required for applications
            'testx': testx,                # for bootstrap of setuplib - not required for applications
            'build_java': build_java,      # for bootstrap of setuplib - not required for applications
            'build_jy': build_jy,          # for bootstrap of setuplib - not required for applications
        },
        description=_description,
    #    distclass=setupjavax.dist.Distribution,  # extends the standard help-display of setuptools
        download_url=_download_url,
        entry_points={                    # for standard application
            'distutils.commands': 'build_java = setupjavax.build_java:BuildJava',
            'distutils.commands': 'build_jy = setupjavax.build_jy:BuildJy',
        },
        install_requires=_install_requires,
        license=_license,
        long_description=_long_description,
        name=_name,
        package_data=_package_data,
        packages=_packages,
        scripts=_scripts,
        url=_url,
        version=_version,
        zip_safe=False,
    )

    if '--help' in sys.argv or '-h' in sys.argv:
        print()
        print("Help on usage extensions by " + str(_name))
        print("   --help-" + str(_name))
        print()

    sys.exit(0)

## 5.2.6. Download

setup.py

## 5.2.7. License

Artistic-License-2.0 + Forced-Fairplay-Constraints

## 5.2.8. Copyright

Copyright (C)2019 Arno-Can Uestuensoez @Ingenieurbuero Arno-Can Uestuensoez