forked from jawah/charset_normalizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
38 lines (28 loc) · 808 Bytes
/
setup.py
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
from re import search
from setuptools import setup
def get_version():
with open('charset_normalizer/version.py') as version_file:
return search(r"""__version__\s+=\s+(['"])(?P<version>.+?)\1""",
version_file.read()).group('version')
USE_MYPYC = False
if len(sys.argv) > 1 and sys.argv[1] == "--use-mypyc":
sys.argv.pop(1)
USE_MYPYC = True
if os.getenv("CHARSET_NORMALIZER_USE_MYPYC", None) == "1":
USE_MYPYC = True
if USE_MYPYC:
from mypyc.build import mypycify
MYPYC_MODULES = mypycify([
"charset_normalizer/md.py",
], debug_level="0")
else:
MYPYC_MODULES = None
setup(
name="charset-normalizer",
version=get_version(),
ext_modules=MYPYC_MODULES
)