setup.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import sys, os
  2. import os.path
  3. import git
  4. from cx_Freeze import setup, Executable
  5. r = git.repo.Repo('./')
  6. targetName="wowviewer"
  7. __version__ = r.git.describe("--tags", "--dirty")
  8. split_ver = __version__.split(".")
  9. split_ver_last = split_ver[2].split("-")
  10. if len(split_ver_last) < 3:
  11. commit_ver = 0
  12. else:
  13. commit_ver = split_ver_last[1]
  14. win_ver = "{maj}.{min}.{mic}.{commit}".format(maj=split_ver[0][1:],
  15. min=split_ver[1],
  16. mic=split_ver_last[0],
  17. commit=commit_ver
  18. )
  19. copyright = "(c) 2018 986-Studio"
  20. packages = ["datetime", "PIL", "tkinter", "wow"]
  21. includes = []
  22. PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
  23. os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
  24. os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
  25. constants="BUILD_VERSION='{ver}'".format(ver=__version__)
  26. base = None
  27. if sys.platform == "win32":
  28. base = "Win32GUI"
  29. includes = [
  30. os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
  31. os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
  32. ]
  33. targetName = targetName + ".exe"
  34. options = {
  35. 'build_exe': {
  36. 'include_files': includes,
  37. 'packages': packages,
  38. 'include_msvcr': True,
  39. 'constants': constants,
  40. },
  41. }
  42. executable = [
  43. Executable("main.py",
  44. base=base,
  45. targetName=targetName,
  46. copyright=copyright,
  47. )
  48. ]
  49. setup(
  50. name = "WOWFileViewer",
  51. description='Viewer for SparkMaker WOW files',
  52. version=win_ver,
  53. options=options,
  54. executables=executable
  55. )