setup_windows.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. def get_config():
  2. import os, sys, _winreg
  3. from setup_common import get_metadata_and_options, enabled, create_release_file
  4. metadata, options = get_metadata_and_options()
  5. serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_key'])
  6. mysql_root, dummy = _winreg.QueryValueEx(serverKey,'Location')
  7. extra_objects = []
  8. static = enabled(options, 'static')
  9. # XXX static doesn't actually do anything on Windows
  10. if enabled(options, 'embedded'):
  11. client = "mysqld"
  12. else:
  13. client = "mysqlclient"
  14. library_dirs = [ os.path.join(mysql_root, r'lib\opt') ]
  15. libraries = [ 'kernel32', 'advapi32', 'wsock32', client ]
  16. include_dirs = [ os.path.join(mysql_root, r'include') ]
  17. extra_compile_args = [ '/Zl' ]
  18. name = "MySQL-python"
  19. if enabled(options, 'embedded'):
  20. name = name + "-embedded"
  21. metadata['name'] = name
  22. define_macros = [
  23. ('version_info', metadata['version_info']),
  24. ('__version__', metadata['version']),
  25. ]
  26. create_release_file(metadata)
  27. del metadata['version_info']
  28. ext_options = dict(
  29. name = "_mysql",
  30. library_dirs = library_dirs,
  31. libraries = libraries,
  32. extra_compile_args = extra_compile_args,
  33. include_dirs = include_dirs,
  34. extra_objects = extra_objects,
  35. define_macros = define_macros,
  36. )
  37. return metadata, ext_options
  38. if __name__ == "__main__":
  39. print """You shouldn't be running this directly; it is used by setup.py."""