Skip to content

Commit ada567a

Browse files
author
adustman
committed
Windows build. Completely untested.
1 parent 344468a commit ada567a

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

MySQLdb/setup_windows.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
def get_config():
2+
import os, sys, _winreg
3+
from setup_common import get_metadata_and_options, enabled, create_release_file
4+
5+
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,
6+
r'SOFTWARE\MySQL AB\MySQL Server 5.0')
7+
mysql_root, dummy = _winreg.QueryValueEx(serverKey,'Location')
8+
metadata, options = get_metadata_and_options()
9+
10+
extra_objects = []
11+
static = enabled(options, 'static')
12+
if enabled(options, 'embedded'):
13+
client = "mysqld"
14+
else:
15+
client = "mysqlclient"
16+
17+
library_dirs = [ os.path.join(mysql_root, r'\lib\opt') ]
18+
libraries = [ 'kernel32', 'advapi32', 'wsock32', client ]
19+
include_dirs = [ os.path.join(mysql_root, r'\include') ]
20+
extra_compile_args = [ '/Zl' ]
21+
22+
name = "MySQL-%s" % os.path.basename(sys.executable)
23+
if enabled(options, 'embedded'):
24+
name = name + "-embedded"
25+
metadata['name'] = name
26+
27+
define_macros = [
28+
('version_info', metadata['version_info']),
29+
('__version__', metadata['version']),
30+
]
31+
create_release_file(metadata)
32+
del metadata['version_info']
33+
ext_options = dict(
34+
name = "_mysql",
35+
library_dirs = library_dirs,
36+
libraries = libraries,
37+
extra_compile_args = extra_compile_args,
38+
include_dirs = include_dirs,
39+
extra_objects = extra_objects,
40+
define_macros = define_macros,
41+
)
42+
return metadata, ext_options
43+
44+
if __name__ == "__main__":
45+
print """You shouldn't be running this directly; it is used by setup.py."""
46+

0 commit comments

Comments
 (0)