setup   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 9
eloc 45
dl 0
loc 61
rs 10
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A is_new_osx() 0 9 4
A clean() 0 5 4
A setup_package() 0 13 1
1
import sys
2
import distutils.util
3
from pathlib import Path
4
from setuptools import setup, find_packages
5
6
PACKAGES = find_packages()
7
COMPILE_OPTIONS = {
8
    "msvc": ["/Ox", "/EHsc"],
9
    "other": ["-O3", "-Wno-strict-prototypes", "-Wno-unused-function"],
10
}
11
COMPILER_DIRECTIVES = {
12
    "language_level": -3,
13
    "embedsignature": True,
14
    "annotation_typing": False,
15
}
16
LINK_OPTIONS = {"msvc": [], "other": []}
17
18
19
def is_new_osx():
20
    """Check whether we're on OSX >= 10.10"""
21
    name = distutils.util.get_platform()
22
    if sys.platform != "darwin": return False
23
    elif name.startswith("macosx-10"):
24
        minor_version = int(name.split("-")[1].split(".")[1])
25
        if minor_version >= 7:  return True
26
        else:                   return False
27
    else:                       return False
28
29
30
if is_new_osx():
31
    COMPILE_OPTIONS["other"].append("-stdlib=libc++")
32
    LINK_OPTIONS["other"].append("-lc++")
33
    LINK_OPTIONS["other"].append("-nodefaultlibs")
34
35
36
def clean(path):
37
    for path in path.glob("**/*"):
38
        if path.is_file() and path.suffix in (".so", ".cpp"):
39
            print(f"Deleting {path.name}")
40
            path.unlink()
41
42
43
def setup_package():
44
    root = Path(__file__).parent
45
46
    setup(
47
        name='tracking_policy_agendas',
48
        packages=PACKAGES,
49
        version='1.0.1',
50
        url='https://github.com/MohammadForouhesh/tracking-policy-agendas',
51
        license='MIT',
52
        author='MohammadForouhesh',
53
        author_email='[email protected]',
54
        description='A Persian Twitter policy agenda tracking framework',
55
        package_data={"": ["*.pyx", "*.pxd", "*.pxi", "*.cu"]},
56
    )
57
58
59
if __name__ == '__main__':
60
    setup_package()
61