setup_windows.py 1.3 KB

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