Advertisement
here2share

py2any.py Distribution Reference --

Dec 7th, 2015
205
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 5.09 KB | None | 0 0
  1. py2any.py Distribution Reference --
  2.  
  3. The guidata.disthelpers module provides helper functions for Python package distribution on Microsoft Windows platforms with py2exe or on all platforms thanks to cx_Freeze.
  4.  
  5. class guidata.disthelpers.Distribution
  6. Distribution object
  7.  
  8. Help creating an executable using py2exe or cx_Freeze
  9.  
  10. add_executable(script, target_name, icon=None)
  11. Add executable to the cx_Freeze distribution Not supported for py2exe
  12.  
  13. add_matplotlib()
  14. Include module Matplotlib to the distribution
  15.  
  16. add_module_data_dir(module_name, data_dir_name, extensions, copy_to_root=True, verbose=False, exclude_dirs=[])
  17. Collect data files in data_dir_name for module module_name and add them to data_files extensions: list of file extensions, e.g. (‘.png, ‘.svg)
  18.  
  19. add_module_data_files(module_name, data_dir_names, extensions, copy_to_root=True, verbose=False, exclude_dirs=[])
  20. Collect data files for module module_name and add them to data_files data_dir_names: list of dirnames, e.g. (‘images’, ) extensions: list of file extensions, e.g. (‘.png, ‘.svg)
  21.  
  22. add_module_dir(module_name, verbose=False, exclude_dirs=[])
  23. Collect all module files for module module_name and add them to data_files
  24.  
  25. add_modules(*module_names)
  26. Include module module_name
  27.  
  28. add_pyqt()
  29. Include module PyQt4 or PyQt5 to the distribution
  30.  
  31. add_pyside()
  32. Include module PySide to the distribution
  33.  
  34. add_qt_bindings()
  35. Include Qt bindings, i.e. PyQt4 or PySide
  36.  
  37. add_text_data_file(filename, contents)
  38. Create temporary data file filename with contents and add it to data_files
  39.  
  40. build(library, cleanup=True, create_archive=None)
  41. Build executable with given library.
  42.  
  43. library:
  44. ‘py2exe’: deploy using the py2exe library
  45. ‘cx_Freeze’: deploy using the cx_Freeze library
  46. cleanup: remove ‘build/dist’ directories before building distribution
  47.  
  48. create_archive (requires the executable zip):
  49. None or False: do nothing
  50. ‘add’: add target directory to a ZIP archive
  51. ‘move’: move target directory to a ZIP archive
  52. build_cx_freeze(cleanup=True, create_archive=None)
  53. Build executable with cx_Freeze
  54.  
  55. cleanup: remove ‘build/dist’ directories before building distribution
  56.  
  57. create_archive (requires the executable zip):
  58. None or False: do nothing
  59. ‘add’: add target directory to a ZIP archive
  60. ‘move’: move target directory to a ZIP archive
  61. build_py2exe(cleanup=True, compressed=2, optimize=2, company_name=None, copyright=None, create_archive=None)
  62. Build executable with py2exe
  63.  
  64. cleanup: remove ‘build/dist’ directories before building distribution
  65.  
  66. create_archive (requires the executable zip):
  67. None or False: do nothing
  68. ‘add’: add target directory to a ZIP archive
  69. ‘move’: move target directory to a ZIP archive
  70. setup(name, version, description, script, target_name=None, target_dir=None, icon=None, data_files=None, includes=None, excludes=None, bin_includes=None, bin_excludes=None, bin_path_includes=None, bin_path_excludes=None, msvc=None)
  71. Setup distribution object
  72.  
  73. Notes:
  74. bin_path_excludes is specific to cx_Freeze (ignored if it’s None)
  75. if msvc is None, it’s set to True by default on Windows platforms, False on non-Windows platforms
  76. target_dir
  77. Return target directory (default: ‘dist’)
  78.  
  79. guidata.disthelpers.create_msvc_data_files(architecture=None, python_version=None, verbose=False)
  80. Including Microsoft Visual C++ DLLs
  81.  
  82. guidata.disthelpers.get_changeset(path, rev=None)
  83. Return Mercurial repository path revision number
  84.  
  85. guidata.disthelpers.get_dll_architecture(path)
  86. Return DLL architecture (32 or 64bit) using Microsoft dumpbin.exe
  87.  
  88. guidata.disthelpers.get_msvc_dlls(msvc_version, architecture=None, check_architecture=False)
  89. Get the list of Microsoft Visual C++ DLLs associated to architecture and Python version, create the manifest file.
  90.  
  91. architecture: integer (32 or 64)if None, take the Python build arch python_version: X.Y
  92.  
  93. guidata.disthelpers.get_msvc_version(python_version)
  94. Return Microsoft Visual C++ version used to build this Python version
  95.  
  96. guidata.disthelpers.prepend_module_to_path(module_path)
  97. Prepend to sys.path module located in module_path Return string with module infos: name, revision, changeset
  98.  
  99. Use this function: 1) In your application to import local frozen copies of internal libraries 2) In your py2exe distributed package to add a text file containing the returned string
  100.  
  101. guidata.disthelpers.prepend_modules_to_path(module_base_path)
  102. Prepend to sys.path all modules located in module_base_path
  103.  
  104. guidata.disthelpers.remove_dir(dirname)
  105. Remove directory dirname and all its contents Print details about the operation (progress, success/failure)
  106.  
  107. guidata.disthelpers.strip_version(version)
  108. Return version number with digits only (Windows does not support strings in version numbers)
  109.  
  110. guidata.disthelpers.to_include_files(data_files)
  111. Convert data_files list to include_files list
  112.  
  113. data_files:
  114. this is the py2exe data files format
  115. list of tuples (dest_dirname, (src_fname1, src_fname2, ...))
  116. include_files:
  117. this is the cx_Freeze data files format
  118.  
  119. list of tuples ((src_fname1, dst_fname1),
  120. (src_fname2, dst_fname2), ...))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement