make_win32.py 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. ############################################################
  2. # FlatCAM: 2D Post-processing for Manufacturing #
  3. # http://flatcam.org #
  4. # Author: Juan Pablo Caram (c) #
  5. # Date: 2/5/2014 #
  6. # MIT Licence #
  7. # #
  8. # Creates a portlable 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
  21. from cx_Freeze import setup, Executable
  22. # this is done to solve the tkinter not being found (Python3)
  23. # still the DLL's need to be copied to the lib folder but the script can't do it
  24. PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
  25. os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
  26. os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')
  27. ## Get the site-package folder, not everybody will install
  28. ## Python into C:\PythonXX
  29. site_dir = site.getsitepackages()[1]
  30. include_files = []
  31. include_files.append((os.path.join(site_dir, "shapely"), "shapely"))
  32. include_files.append((os.path.join(site_dir, "svg"), "svg"))
  33. include_files.append((os.path.join(site_dir, "svg/path"), "svg"))
  34. include_files.append((os.path.join(site_dir, "matplotlib"), "matplotlib"))
  35. include_files.append(("share", "share"))
  36. include_files.append((os.path.join(site_dir, "rtree"), "rtree"))
  37. include_files.append(("README.md", "README.md"))
  38. include_files.append(("LICENSE", "LICENSE"))
  39. base = None
  40. ## Lets not open the console while running the app
  41. if sys.platform == "win32":
  42. base = "Win32GUI"
  43. buildOptions = dict(
  44. include_files=include_files,
  45. # excludes=['PyQt4', 'tk', 'tcl']
  46. excludes=['scipy.lib.lapack.flapack.pyd',
  47. 'scipy.lib.blas.fblas.pyd',
  48. 'QtOpenGL4.dll']
  49. )
  50. print(("INCLUDE_FILES", include_files))
  51. exec(compile(open('clean.py').read(), 'clean.py', 'exec'))
  52. setup(
  53. name="FlatCAM",
  54. author="Juan Pablo Caram",
  55. version="8.5",
  56. description="FlatCAM: 2D Computer Aided PCB Manufacturing",
  57. options=dict(build_exe=buildOptions),
  58. executables=[Executable("FlatCAM.py", icon='share/flatcam_icon48.ico', base=base)]
  59. )