-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsetup.py
More file actions
124 lines (106 loc) · 3.06 KB
/
setup.py
File metadata and controls
124 lines (106 loc) · 3.06 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
#!/usr/bin/env python
"""
Copyright (c) 2017-2022, Jairus Martin.
Distributed under the terms of the GPL v3 License.
The full license is in the file COPYING.txt, distributed with this software.
Created on Dec 13, 2017
"""
import os
import re
import sys
from glob import glob
from setuptools import find_packages, setup
try:
from pybind11.setup_helpers import Pybind11Extension, build_ext
except ImportError:
Pybind11Extension = None
requirements = [
"enaml>=0.10.4",
"jsonpickle",
"qtconsole",
"numpydoc",
"markdown",
"enamlx",
"asyncqtpy", # asyncio + qt
"pyserial>=3.5",
"pyqcodeeditor", # text editor
"ezdxf",
"pdf4py",
]
if sys.platform == "win32":
requirements.extend(
[
"pywin32",
]
)
def find_include(name: str) -> str:
prefix = os.path.dirname(os.path.dirname(sys.executable))
return os.path.join(prefix, "include", name)
def find_lib(name: str) -> str:
prefix = os.path.dirname(os.path.dirname(sys.executable))
return os.path.join(prefix, "lib", name)
def find_version():
with open("declaracad/__init__.py") as f:
for line in f:
m = re.search(r'version = [\'"](.+)["\']', line)
if m:
return m.group(1)
raise Exception("Could not find version in declaracad/__init__.py")
def find_pyocct():
project_dir = os.path.dirname(os.path.dirname(__file__))
return os.path.join(project_dir, "pyOCCT")
pyocct_dir = find_pyocct()
cmdclass = {}
ext_modules = []
if Pybind11Extension is not None:
cmdclss = {"build_ext": build_ext}
ext_module = Pybind11Extension(
"declaracad.helpers",
optional=sys.platform != "linux",
sources=glob("src/helpers.cpp"),
include_dirs=[
"src",
find_include("opencascade"),
find_include("qt6"),
find_include("qt6/QtCore"),
find_include("qt6/QtGui"),
find_include("qt6/QtOpenGLWidgets"),
os.path.join(pyocct_dir, "inc"),
os.path.join(pyocct_dir, "src"),
],
libraries=[
# "TKernel", "TKOpenGl", "TKVoxel"
# "Qt6Core",
"TKernel",
"TKOpenGl",
"Qt6Gui",
"Qt6Widgets",
"Qt6OpenGLWidgets",
],
# define_macros = [('VERSION_INFO', __version__)],
)
ext_modules.append(ext_module)
setup(
name="declaracad",
version=find_version(),
description="Parametric 3D modeling with enaml and OpenCascade",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
author="CodeLV",
author_email="frmdstryr@gmail.com",
license="GPL3",
url="https://github.com/codelv/declaracad",
entry_points={
"console_scripts": [
"declaracad = declaracad:main",
]
},
packages=find_packages(),
package_data={
"declaracad": ["*/*.enaml", "*/*.png", "*/*.svg"],
},
ext_modules=ext_modules,
cmdclass=cmdclass,
python_requires=">=3.10",
install_requires=requirements,
)