2626from pathlib import Path
2727import platform
2828import struct
29+ import subprocess
2930import sys
3031
3132from setuptools import setup , Extension
4041else :
4142 # Force `setup_requires` stuff like Cython to be installed before proceeding
4243 from setuptools .dist import Distribution
43- Distribution (dict (setup_requires = 'Cython>=0.29.21 ' ))
44+ Distribution (dict (setup_requires = 'Cython>=3.0 ' ))
4445 from Cython .Distutils import build_ext as _build_ext
4546
4647def check_env (env_name , default ):
@@ -65,7 +66,7 @@ def check_env(env_name, default):
6566library_dirs = []
6667libraries = ['sybdb' ]
6768
68- prefix = None
69+ prefix = "/usr/local"
6970if os .getenv ('PYMSSQL_FREETDS' ):
7071 prefix = os .path .abspath (os .getenv ('PYMSSQL_FREETDS' ).strip ())
7172elif exists ("/usr/local/include/sqlfront.h" ):
@@ -78,20 +79,26 @@ def check_env(env_name, default):
7879 prefix = "/opt/local"
7980elif exists ("/sw/include/sqlfront.h" ): # Fink
8081 prefix = "/sw"
82+ print (f"prefix='{ prefix } '" )
8183
82- if prefix :
83- print (f"prefix='{ prefix } '" )
84+ if os .getenv ('PYMSSQL_FREETDS_INCLUDEDIR' ):
85+ include_dirs = [ os .getenv ('PYMSSQL_FREETDS_INCLUDEDIR' ) ]
86+ else :
8487 include_dirs = [ join (prefix , "include" ) ]
88+
89+ if os .getenv ('PYMSSQL_FREETDS_LIBDIR' ):
90+ library_dirs = [ os .getenv ('PYMSSQL_FREETDS_LIBDIR' ) ]
91+ else :
8592 if BITNESS == 64 and exists (join (prefix , "lib64" )):
8693 library_dirs = [ join (prefix , "lib64" ) ]
8794 else :
8895 library_dirs = [ join (prefix , "lib" ) ]
8996
90- if os . getenv ( 'PYMSSQL_FREETDS_INCLUDEDIR' ) :
91- include_dirs = [ os . getenv ( 'PYMSSQL_FREETDS_INCLUDEDIR' ) ]
92-
93- if os . getenv ( 'PYMSSQL_FREETDS_LIBDIR' ):
94- library_dirs = [ os . getenv ( 'PYMSSQL_FREETDS_LIBDIR' ) ]
97+ if MACOS :
98+ pref = subprocess . getoutput ( 'brew --prefix openssl' )
99+ print ( f"PREFIX= { pref } " )
100+ include_dirs . append ( f" { pref } /include" )
101+ library_dirs . append ( f" { pref } /lib" )
95102
96103print ("setup.py: platform.system() =>" , platform .system ())
97104print ("setup.py: platform.architecture() =>" , platform .architecture ())
0 commit comments