setup.main()   B
last analyzed

Complexity

Conditions 4

Size

Total Lines 93
Code Lines 86

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 86
nop 0
dl 0
loc 93
rs 7.4581
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
#!/usr/bin/env python3
2
"""Setuptools setup file."""
3
4
from sys import version_info
5
6
from setuptools import find_packages, setup
7
8
import versioneer
9
10
__author__ = "Thurask"
11
__license__ = "WTFPL v2"
12
__copyright__ = "2015-2019 Thurask"
13
14
15
def readme():
16
    """
17
    Read ReST readme file, use as long description.
18
    """
19
    with open('README.rst') as file:
20
        data = file.read()
21
        data = data.replace("`LICENSE <LICENSE>`__", "LICENSE")
22
        return data
23
24
def main():
25
    """
26
    Perform setuptools setup.
27
    """
28
    cond_requires = [
29
        'python-gnupg>=0.3.9',
30
        'beautifulsoup4>=4.5.3',
31
        'appdirs>=1.4.3',
32
        'user_agent>=0.1.9'
33
    ]
34
    if version_info[1] == 2:  # 3.2; shutilwhich, no simplejson, old requests/defusedxml
35
        deplist = ['shutilwhich>=1.1.0', 'requests==2.10', 'defusedxml==0.4.1']
36
    elif version_info[1] == 3:  # 3.3; simplejson, old requests/defusedxml
37
        deplist = ['simplejson>=3.10.0', 'requests>=2.10.0,<2.18.4', 'defusedxml==0.4.1']
38
    elif version_info[1] == 4:  # 3.4; simplejson, old defusedxml, new requests
39
        deplist = ['simplejson>=3.10.0', 'requests>=2.10.0', 'defusedxml==0.5.0']
40
    else:  # 3.5+; simplejson, new requests/defusedxml
41
        deplist = ['simplejson>=3.10.0', 'requests>=2.10.0', 'defusedxml>=0.5.0']
42
    cond_requires.extend(deplist)
43
    scriptlist = [
44
        'bb-archivist=bbarchivist.scripts.archivist:grab_args',
45
        'bb-lazyloader=bbarchivist.scripts.lazyloader:grab_args',
46
        'bb-cchecker=bbarchivist.scripts.carrierchecker:grab_args',
47
        'bb-certchecker=bbarchivist.scripts.certchecker:grab_args',
48
        'bb-filehasher=bbarchivist.scripts.filehasher:filehasher_main',
49
        'bb-escreens=bbarchivist.scripts.escreens:escreens_main',
50
        'bb-linkgen=bbarchivist.scripts.linkgen:grab_args',
51
        'bb-gpgrunner=bbarchivist.scripts.gpgrunner:gpgrunner_main',
52
        'bb-autolookup=bbarchivist.scripts.autolookup:grab_args',
53
        'bb-pseudocap=bbarchivist.scripts.pycaptool:pycaptool_main',
54
        'bb-sqlexport=bbarchivist.scripts.sqlexport:grab_args',
55
        'bb-kompressor=bbarchivist.scripts.kompressor:kompressor_main',
56
        'bb-downloader=bbarchivist.scripts.downloader:grab_args',
57
        'bb-kernchecker=bbarchivist.scripts.kernchecker:grab_args',
58
        'bb-cfp=bbarchivist.scripts.exeshim:cfp_main',
59
        'bb-cap=bbarchivist.scripts.exeshim:cap_main',
60
        'bb-droidlookup=bbarchivist.scripts.droidlookup:grab_args',
61
        'bb-metachecker=bbarchivist.scripts.metachecker:metachecker_main',
62
        'bb-devloader=bbarchivist.scripts.devloader:grab_args',
63
        'bb-swlookup=bbarchivist.scripts.swlookup:grab_args',
64
        'bb-infogen=bbarchivist.scripts.infogenerator:grab_args',
65
        'bb-droidscraper=bbarchivist.scripts.droidscraper:droidscraper_main',
66
        'bb-barlinker=bbarchivist.scripts.barlinker:barlinker_main',
67
        'bb-tclscan=bbarchivist.scripts.tclscan:grab_args',
68
        'bb-tclloader=bbarchivist.scripts.tclloader:grab_args',
69
        'bb-tcldelta=bbarchivist.scripts.tcldelta:grab_args',
70
        'bb-tclnewprd=bbarchivist.scripts.tclnewprd:grab_args'
71
    ]
72
    setup(name='bbarchivist',
73
          version=versioneer.get_version().split("-")[0],
74
          cmdclass=versioneer.get_cmdclass(),
75
          description='BlackBerry OS tools, in Pythons',
76
          long_description=readme(),
77
          url='https://github.com/thurask/bbarchivist',
78
          keywords='blackberry autoloader android',
79
          author='Thurask',
80
          author_email='[email protected]',
81
          license='WTFPL v2',
82
          classifiers=[
83
              "Development Status :: 5 - Production/Stable",
84
              "Environment :: Console",
85
              "Environment :: MacOS X",
86
              "Environment :: Win32 (MS Windows)",
87
              "Environment :: X11 Applications",
88
              "Intended Audience :: End Users/Desktop",
89
              "License :: Freely Distributable",
90
              "Operating System :: MacOS",
91
              "Operating System :: MacOS :: MacOS X",
92
              "Operating System :: Microsoft",
93
              "Operating System :: Microsoft :: Windows",
94
              "Operating System :: OS Independent",
95
              "Operating System :: POSIX",
96
              "Operating System :: POSIX :: BSD :: FreeBSD",
97
              "Operating System :: POSIX :: BSD :: NetBSD",
98
              "Operating System :: POSIX :: BSD :: OpenBSD",
99
              "Operating System :: POSIX :: Linux",
100
              "Operating System :: Unix",
101
              "Programming Language :: Python :: 3.2",
102
              "Programming Language :: Python :: 3.3",
103
              "Programming Language :: Python :: 3.4",
104
              "Programming Language :: Python :: 3.5",
105
              "Programming Language :: Python :: 3.6",
106
              "Programming Language :: Python :: 3.7",
107
              "Programming Language :: Python :: 3",
108
              "Programming Language :: Python :: 3 :: Only",
109
              "Topic :: Utilities"
110
          ],
111
          python_requires=">=3.2",
112
          packages=find_packages(),
113
          zip_safe=False,
114
          include_package_data=True,
115
          install_requires=cond_requires,
116
          entry_points={'console_scripts': scriptlist})
117
118
if __name__ == "__main__":
119
    main()
120