-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
119 lines (110 loc) · 6.67 KB
/
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
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
# cython: language_level=2
import sys
from setuptools import setup
from setuptools.extension import Extension
if '--build-cython' in sys.argv:
# if this is is the system building the package from source, use the py files (or pyx)
index = sys.argv.index('--build-cython')
sys.argv.pop(index) # Removes the '--foo'
ext = '.py'
ext2= '.pyx' # X when needed
prefix=''
print("Using Cython")
USE_CYTHON=True
else:
# if this is a package install, use the c files and build/register modules
ext = '.c'
ext2 = '.c'
prefix=''
USE_CYTHON=None
# cython: linetrace=True
# cython: binding=True
# distutils: define_macros=CYTHON_TRACE_NOGIL=1
extensions = [
#data import
Extension("ttygif.asciicast.reader" ,[prefix+"./ttygif/asciicast/reader" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
#gif minipulation
Extension("ttygif.gif.application_extension" ,[prefix+"./ttygif/gif/application_extension" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.color_table" ,[prefix+"./ttygif/gif/color_table" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.CommentExtension" ,[prefix+"./ttygif/gif/CommentExtension" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.graphics_control_extension" ,[prefix+"./ttygif/gif/graphics_control_extension" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.header" ,[prefix+"./ttygif/gif/header" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.image_descriptor" ,[prefix+"./ttygif/gif/image_descriptor" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.PlainTextExtension" ,[prefix+"./ttygif/gif/PlainTextExtension" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.stream" ,[prefix+"./ttygif/gif/stream" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.trailer" ,[prefix+"./ttygif/gif/trailer" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.tools.passthrough" ,[prefix+"./ttygif/tools/passthrough" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.image" ,[prefix+"./ttygif/gif/image" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.decode" ,[prefix+"./ttygif/gif/decode" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.encode" ,[prefix+"./ttygif/gif/encode" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.canvas" ,[prefix+"./ttygif/gif/canvas" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.gif.gif" ,[prefix+"./ttygif/gif/gif" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
# graphical rendering
Extension("ttygif.tty.font" ,[prefix+"./ttygif/tty/font" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
# Extension("ttygif.tty.fonts" ,[prefix+"./ttygif/tty/fonts" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.tty.display_state" ,[prefix+"./ttygif/tty/display_state" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.tty.image" ,[prefix+"./ttygif/tty/image" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.tty.parser" ,[prefix+"./ttygif/tty/parser" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.tty.theme" ,[prefix+"./ttygif/tty/theme" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.tty.terminal_graphics" ,[prefix+"./ttygif/tty/terminal_graphics" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.tty.terminal_emulator" ,[prefix+"./ttygif/tty/terminal_emulator" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.tty.graphics" ,[prefix+"./ttygif/tty/graphics" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
# gif orchestraton of frames and data
Extension("ttygif.cast2gif" ,[prefix+"./ttygif/cast2gif" +ext2], define_macros=[('CYTHON_TRACE', '1')]),
Extension("ttygif.version" ,[prefix+"./ttygif/version" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
#Extension("ttygif.cli" ,[prefix+"./ttygif/cli" +ext ], define_macros=[('CYTHON_TRACE', '1')]),
]
if USE_CYTHON:
try:
from Cython.Build import cythonize
extensions = cythonize(extensions)
except BaseException as be:
print (be)
print("You don't seem to have Cython installed.")
print("www.cython.org")
print("with pip ->pip install cython --user")
print("with a pipenv ->pipenv install cython")
print("Building")
exit(1)
else:
print("Not using CYTHON")
packages=[ 'ttygif',
'ttygif.tty',
'ttygif.gif',
'ttygif.tools',
'ttygif.asciicast'
]
ver=sys.version_info
exec(open('ttygif/version.py').read())
setup(
name='ttygif',
version=__version__,
packages=packages,
include_package_data=True,
url='https://github.com/chris17453/ttygif/',
license='Creative Commons Attribution-Noncommercial-Share Alike license',
long_description=open('README.md').read(),
long_description_content_type="text/markdown",
author='Chris Watkins',
author_email='chris@watkinslabs.com',
description='A asciicast to gif utility',
ext_modules=extensions,
classifiers=[
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.7',
"Development Status :: 3 - Alpha",
"Operating System :: OS Independent",
],
entry_points="""
[console_scripts]
ttygif = ttygif.cli:main
""",
compiler_directives={"language_level": ver.major},
install_requires=[
# Setuptools 18.0 properly handles Cython extensions.
'setuptools>=18.0',
'wheel',
'Cython',
'future',
],
)