-
-
Notifications
You must be signed in to change notification settings - Fork 25
Expand file tree
/
Copy pathsetup.py
More file actions
161 lines (154 loc) · 5.09 KB
/
setup.py
File metadata and controls
161 lines (154 loc) · 5.09 KB
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
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
import subprocess
import platform
from setuptools import setup, find_packages
from setuptools.command.install import install as _install
from pathlib import Path
this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()
class install(_install):
def run(self):
print("--------------------------------------------------------------------")
print("Detecting Operating System")
operating_system = platform.system()
if operating_system == "Windows":
print("Windows Detected, using the kaitai-struct-compiler.bat")
kaitai_compiler_executable = "kaitai-struct-compiler.bat"
else:
print("Linux or Mac Detected, using the ksc executable")
kaitai_compiler_executable = "ksc"
print("--------------------------------------------------------------------")
print("Compiling Dat/Day.ksy")
subprocess.run(
[
kaitai_compiler_executable,
"-t",
"python",
"--outdir",
"acd/generated/",
"--python-package",
"acd.generated",
"resources/templates/Dat/Dat.ksy",
]
)
print("Compiling Comps/FAFA_Comps.ksy")
subprocess.run(
[
kaitai_compiler_executable,
"-t",
"python",
"--outdir",
"acd/generated/comps/",
"--python-package",
"acd.generated.comps",
"resources/templates/Comps/FAFA_Comps.ksy",
]
)
print("Compiling SbRegion/FAFA_SbRegion.ksy")
subprocess.run(
[
kaitai_compiler_executable,
"-t",
"python",
"--outdir",
"acd/generated/sbregion/",
"--python-package",
"acd.generated.sbregion",
"resources/templates/SbRegion/FAFA_SbRegion.ksy",
]
)
print("Compiling Comps/FDFD_Comps.ksy")
subprocess.run(
[
kaitai_compiler_executable,
"-t",
"python",
"--outdir",
"acd/generated/comps/",
"--python-package",
"acd.generated.comps",
"resources/templates/Comps/FDFD_Comps.ksy",
]
)
print("Compiling Comments/FAFA_Comments.ksy")
subprocess.run(
[
kaitai_compiler_executable,
"-t",
"python",
"--outdir",
"acd/generated/comments/",
"--python-package",
"acd.generated.comments",
"resources/templates/Comments/FAFA_Comments.ksy",
]
)
print("Compiling Comps/RxGeneric.ksy")
subprocess.run(
[
kaitai_compiler_executable,
"-t",
"python",
"--outdir",
"acd/generated/comps/",
"--python-package",
"acd.generated.comps",
"resources/templates/Comps/RxGeneric.ksy",
]
)
_install.run(self)
print("--------------------------------------------------------------------")
setup(
name="acd-tools",
version="0.2a8",
description="Rockwell ACD File Tools",
classifiers=[
"Development Status :: 3 - Alpha",
"Programming Language :: Python :: 3.8",
"Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator",
],
keywords="rockwell acd logix",
url="https://github.com/hutcheb/acd",
author="Ben Hutcheson",
author_email="",
license="Apache 2.0",
long_description=long_description,
long_description_content_type="text/markdown",
packages=find_packages(include=["acd", "acd.*"]),
setup_requires=[
"wheel",
],
install_requires=[
"loguru",
"kaitaistruct",
],
extras_require={
"dev": [
"requires",
"pytest-asyncio",
"pip-tools",
"pre-commit",
"pytest-mock",
"mock",
"mypy",
]
},
cmdclass={"install": install},
)