make_win.py 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. ############################################################
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # http://flatcam.org #
  4. # Author: Juan Pablo Caram (c) #
  5. # Date: 12/20/2018 #
  6. # MIT Licence #
  7. # #
  8. # Creates a portable copy of FlatCAM, including Python #
  9. # itself and all dependencies. #
  10. # #
  11. # This is not an aid to install FlatCAM from source on #
  12. # Windows platforms. It is only useful when FlatCAM is up #
  13. # and running and ready to be packaged. #
  14. ############################################################
  15. # Files not needed: Qt, tk.dll, tcl.dll, tk/, tcl/, vtk/,
  16. # scipy.lib.lapack.flapack.pyd, scipy.lib.blas.fblas.pyd,
  17. # numpy.core._dotblas.pyd, scipy.sparse.sparsetools._bsr.pyd,
  18. # scipy.sparse.sparsetools._csr.pyd, scipy.sparse.sparsetools._csc.pyd,
  19. # scipy.sparse.sparsetools._coo.pyd
  20. import os, site, sys, platform
  21. from cx_Freeze import setup, Executable
  22. # this is done to solve the tkinter not being found
  23. PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
  24. os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
  25. os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
  26. # Get the site-package folder, not everybody will install
  27. # Python into C:\PythonXX
  28. site_dir = site.getsitepackages()[1]
  29. include_files = []
  30. include_files.append((os.path.join(site_dir, "shapely"), "shapely"))
  31. include_files.append((os.path.join(site_dir, "svg"), "svg"))
  32. include_files.append((os.path.join(site_dir, "svg/path"), "svg"))
  33. include_files.append((os.path.join(site_dir, "vispy"), "vispy"))
  34. include_files.append((os.path.join(site_dir, "vispy/app"), "vispy/app"))
  35. include_files.append((os.path.join(site_dir, "vispy/app/backends"), "vispy/app/backends"))
  36. include_files.append((os.path.join(site_dir, "rtree"), "rtree"))
  37. if platform.architecture()[0] == '64bit':
  38. include_files.append((os.path.join(site_dir, "google"), "google"))
  39. include_files.append((os.path.join(site_dir, "google/protobuf"), "google/protobuf"))
  40. include_files.append((os.path.join(site_dir, "ortools"), "ortools"))
  41. include_files.append(("share", "lib/share"))
  42. include_files.append(("postprocessors", "lib/postprocessors"))
  43. include_files.append(("README.md", "README.md"))
  44. include_files.append(("LICENSE", "LICENSE"))
  45. base = None
  46. # Lets not open the console while running the app
  47. if sys.platform == "win32":
  48. base = "Win32GUI"
  49. if platform.architecture()[0] == '64bit':
  50. buildOptions = dict(
  51. include_files=include_files,
  52. excludes=['scipy','pytz'],
  53. # packages=['OpenGL','numpy','vispy','ortools','google']
  54. packages=['numpy','google', 'rasterio'] # works for Python 3.7
  55. # packages = ['opengl', 'numpy', 'google', 'rasterio'] # works for Python 3.6.5
  56. )
  57. else:
  58. buildOptions = dict(
  59. include_files=include_files,
  60. excludes=['scipy', 'pytz'],
  61. # packages=['OpenGL','numpy','vispy','ortools','google']
  62. packages=['numpy', 'rasterio'] # works for Python 3.7
  63. # packages = ['opengl', 'numpy', 'google', 'rasterio'] # works for Python 3.6.5
  64. )
  65. print("INCLUDE_FILES", include_files)
  66. #execfile('clean.py')
  67. setup(
  68. name="FlatCAM",
  69. author="Juan Pablo Caram",
  70. version="3000",
  71. description="FlatCAM: 2D Computer Aided PCB Manufacturing",
  72. options=dict(build_exe=buildOptions),
  73. executables=[Executable("FlatCAM.py", icon='share/flatcam_icon48.ico', base=base)]
  74. )