1717
1818def read (* names , ** kwargs ):
1919 return io .open (
20- os .path .join (here , * names ),
21- encoding = kwargs .get ("encoding" , "utf8" )
20+ os .path .join (here , * names ), encoding = kwargs .get ("encoding" , "utf8" )
2221 ).read ()
2322
2423
2524long_description = read ("README.md" )
2625requirements = read ("requirements.txt" ).split ("\n " )
2726optional_requirements = {}
2827
29- conda_prefix = os .getenv (' CONDA_PREFIX' )
28+ conda_prefix = os .getenv (" CONDA_PREFIX" )
3029
31- windows = os .name == 'nt'
30+ windows = os .name == "nt"
3231
3332
3433def get_pybind_include ():
3534 if windows :
36- return os .path .join (conda_prefix , ' Library' , ' include' )
37- return os .path .join (conda_prefix , ' include' )
35+ return os .path .join (conda_prefix , " Library" , " include" )
36+ return os .path .join (conda_prefix , " include" )
3837
3938
4039def get_eigen_include ():
4140 if windows :
42- return os .path .join (conda_prefix , ' Library' , ' include' , ' eigen3' )
43- return os .path .join (conda_prefix , ' include' , ' eigen3' )
41+ return os .path .join (conda_prefix , " Library" , " include" , " eigen3" )
42+ return os .path .join (conda_prefix , " include" , " eigen3" )
4443
4544
4645def get_library_dirs ():
4746 if windows :
48- return os .path .join (conda_prefix , ' Library' , ' lib' )
49- return os .path .join (conda_prefix , ' lib' )
47+ return os .path .join (conda_prefix , " Library" , " lib" )
48+ return os .path .join (conda_prefix , " lib" )
5049
5150
5251ext_modules = [
5352 Extension (
54- 'compas_cgal._cgal' ,
55- sorted ([
56- 'src/compas_cgal.cpp' ,
57- 'src/compas.cpp' ,
58- 'src/meshing.cpp' ,
59- 'src/booleans.cpp' ,
60- 'src/slicer.cpp' ,
61- 'src/intersections.cpp' ,
62- 'src/measure.cpp' ,
63- 'src/subdivision.cpp' ,
64- 'src/triangulations.cpp' ,
65- ]),
66- include_dirs = [
67- './include' ,
68- get_eigen_include (),
69- get_pybind_include ()
70- ],
53+ "compas_cgal._cgal" ,
54+ sorted (
55+ [
56+ "src/compas_cgal.cpp" ,
57+ "src/compas.cpp" ,
58+ "src/meshing.cpp" ,
59+ "src/booleans.cpp" ,
60+ "src/slicer.cpp" ,
61+ "src/intersections.cpp" ,
62+ "src/measure.cpp" ,
63+ "src/subdivision.cpp" ,
64+ "src/triangulations.cpp" ,
65+ ]
66+ ),
67+ include_dirs = ["./include" , get_eigen_include (), get_pybind_include ()],
7168 library_dirs = [
7269 get_library_dirs (),
7370 ],
74- libraries = [' mpfr' , ' gmp' ],
75- language = ' c++'
71+ libraries = [" mpfr" , " gmp" ],
72+ language = " c++" ,
7673 ),
7774]
7875
@@ -83,8 +80,9 @@ def has_flag(compiler, flagname):
8380 """
8481 import tempfile
8582 import os
86- with tempfile .NamedTemporaryFile ('w' , suffix = '.cpp' , delete = False ) as f :
87- f .write ('int main (int argc, char **argv) { return 0; }' )
83+
84+ with tempfile .NamedTemporaryFile ("w" , suffix = ".cpp" , delete = False ) as f :
85+ f .write ("int main (int argc, char **argv) { return 0; }" )
8886 fname = f .name
8987 try :
9088 compiler .compile ([fname ], extra_postargs = [flagname ])
@@ -104,25 +102,25 @@ def cpp_flag(compiler):
104102 The newer version is prefered over c++11 (when it is available).
105103 """
106104 # flags = ['-std=c++17', '-std=c++14', '-std=c++11']
107- flags = [' -std=c++14' , ' -std=c++11' ]
105+ flags = [" -std=c++14" , " -std=c++11" ]
108106
109107 for flag in flags :
110108 if has_flag (compiler , flag ):
111109 return flag
112110
113- raise RuntimeError ('Unsupported compiler -- at least C++11 support '
114- 'is needed!' )
111+ raise RuntimeError ("Unsupported compiler -- at least C++11 support " "is needed!" )
115112
116113
117114class BuildExt (build_ext ):
118115 """A custom build extension for adding compiler-specific options."""
116+
119117 c_opts = {
120- ' msvc' : [' /EHsc' , ' /std:c++14' ],
121- ' unix' : [],
118+ " msvc" : [" /EHsc" , " /std:c++14" ],
119+ " unix" : [],
122120 }
123121 l_opts = {
124- ' msvc' : [],
125- ' unix' : [],
122+ " msvc" : [],
123+ " unix" : [],
126124 }
127125
128126 # if sys.platform == 'darwin':
@@ -134,14 +132,16 @@ def build_extensions(self):
134132 ct = self .compiler .compiler_type
135133 opts = self .c_opts .get (ct , [])
136134 link_opts = self .l_opts .get (ct , [])
137- if ct == ' unix' :
135+ if ct == " unix" :
138136 opts .append ('-DVERSION_INFO="%s"' % self .distribution .get_version ())
139137 opts .append (cpp_flag (self .compiler ))
140- if has_flag (self .compiler , ' -fvisibility=hidden' ):
141- opts .append (' -fvisibility=hidden' )
142- opts .append (' -DCGAL_DEBUG=1' )
138+ if has_flag (self .compiler , " -fvisibility=hidden" ):
139+ opts .append (" -fvisibility=hidden" )
140+ opts .append (" -DCGAL_DEBUG=1" )
143141 for ext in self .extensions :
144- ext .define_macros = [('VERSION_INFO' , '"{}"' .format (self .distribution .get_version ()))]
142+ ext .define_macros = [
143+ ("VERSION_INFO" , '"{}"' .format (self .distribution .get_version ()))
144+ ]
145145 ext .extra_compile_args = opts
146146 ext .extra_link_args = link_opts
147147 build_ext .build_extensions (self )
@@ -182,8 +182,8 @@ def build_extensions(self):
182182 # data_files=[],
183183 # include_package_data=True,
184184 ext_modules = ext_modules ,
185- cmdclass = {' build_ext' : BuildExt },
186- setup_requires = [' pybind11>=2.5.0' ],
185+ cmdclass = {" build_ext" : BuildExt },
186+ setup_requires = [" pybind11>=2.5.0" ],
187187 install_requires = requirements ,
188188 python_requires = ">=3.6" ,
189189 extras_require = optional_requirements ,
0 commit comments