PageRenderTime 44ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/maintenance/README.md

https://github.com/elrond79/pymel
Markdown | 289 lines | 205 code | 84 blank | 0 comment | 0 complexity | d79933a761aad2345ef04795ed2f64c7 MD5 | raw file
  1. Building an Official PyMEL Release
  2. ==================================
  3. ## 1) Install Dependencies
  4. - git
  5. - graphviz: using an OS package manager like `yum`, `apt-get`, or `brew`, or
  6. on windows, from an [installer](http://www.graphviz.org/Download_windows.php)
  7. - python dependencies:
  8. ```
  9. curl -O https://bootstrap.pypa.io/get-pip.py
  10. # if you have a globally accessible verison of pip it could conflict with the command below
  11. pip install -U pip
  12. # the extra args are to get around an insecure SSL in python < 2.7.9 - see:
  13. # https://urllib3.readthedocs.org/en/latest/security.<html id="insecureplatformwarning"></html>
  14. sudo chmod -R ugo+w $MAYA_LOCATION/
  15. $MAYA_LOCATION/bin/mayapy get-pip.py --index-url=http://pypi.python.org/simple/ --trusted-host pypi.python.org
  16. $MAYA_LOCATION/bin/mayapy -m pip install -r maintenance/requirements.txt --index-url=http://pypi.python.org/simple/ --trusted-host pypi.python.org
  17. ```
  18. ## 2) Build caches
  19. ### Before building the caches
  20. - build caches from WINDOWS... reason being that we need to gather some
  21. information about plugin nodes, and windows has the "most complete" set of
  22. plugins (the only plugins that I know of that are in linux/osx but not in
  23. windows are IGES and stlImport... both of which are file translators only,
  24. with no nodes)
  25. - make sure environment is clean and that you have the default set of user
  26. prefs.
  27. - delete existing cache for version you wish to rebuild
  28. - ensure that the CommandsPython, API, and Nodes doc subdirectories are
  29. installed. these go in `docs/Maya20XX/en_US/`
  30. ### To build the caches
  31. - set the environment variable `MAYA_NO_INITIAL_AUTOLOAD_MT=true` to prevent
  32. the modeling toolkit from being force loaded
  33. - start maya
  34. - in the script editor, run the following, substituting location of your dev
  35. version of pymel:
  36. ```python
  37. import sys
  38. import os
  39. pymelPath = r'E:\Projects\Dev\_work\pymel' # ...or wherever YOUR pymel version is installed
  40. pymelInit = os.path.join(pymelPath, 'pymel', '__init__.py')
  41. if not os.path.isfile(pymelInit):
  42. raise RuntimeError('invalid pymel path: %s' % pymelPath)
  43. if sys.path[0] != pymelPath:
  44. sys.path.insert(0, pymelPath)
  45. import pymel
  46. if not pymel.__file__.startswith(pymelInit): # don't check equality, it may be a .pyc
  47. for mod in list(sys.modules):
  48. if mod.split('.')[0] == 'pymel':
  49. del sys.modules[mod]
  50. import pymel
  51. assert pymel.__file__.startswith(pymelInit)
  52. print pymel.__file__
  53. import pymel.core as pm
  54. ```
  55. - cross your fingers.
  56. - repeat. building of api cache loads plugins, then building of cmd cache
  57. unloads them... unfortunately, some of the built-in plugins may not
  58. unload cleanly, resulting in an error; therefore, it may be necessary
  59. to run the above steps twice (once to build api cache, once for
  60. cmd cache)
  61. ## 3) Run Tests
  62. - cd into tests directory, then
  63. - on WINDOWS run:
  64. ```
  65. pymel_test_output.bat
  66. ```
  67. (note that since windows doesn't have tee, you'll see no output...
  68. look at the contents of pymelTestOut.txt in a text editor, and
  69. hit refresh to see changes!)
  70. - OR, if on linux/mac:
  71. ```
  72. export PATH=$PATH:$MAYA_LOCATION/bin
  73. ./pymel_test_output.bash
  74. ```
  75. - then run the tests in a gui session of maya...
  76. - on windows:
  77. ```
  78. pymel_test_output.bat --gui
  79. ```
  80. again, look at the contents of pymelTestOut.txt in a text editor
  81. - OR, if on linux/mac:
  82. ```
  83. export PATH=$PATH:$MAYA_LOCATION/bin
  84. ./pymel_test_output.bash --gui
  85. ```
  86. ## 4) Resolve Issues
  87. ### Version Constants
  88. Should be indicated by an error in the tests.
  89. run `cmds.about(api=True)` and assign the value to to `pymel.versions.v20XX`
  90. ### New MPx Classes
  91. Indicated by this error:
  92. pymel : WARNING : found new MPx classes: MPxBlendShape. Run pymel.api.plugins._suggestNewMPxValues()
  93. - In `pymel.api.plugins` add a new `DependNode` sublcass for each missing type:
  94. ```python
  95. # new in 2016
  96. if hasattr(mpx, 'MPxBlendShape'):
  97. class BlendShape(DependNode, mpx.MPxBlendShape): pass
  98. ```
  99. The `DependNode` classes are required for the next step to work (which I
  100. would like to fix this eventually.)
  101. - Run `_suggestNewMPxValues()` which will print out dictionary names and new
  102. values to add to them. You should verify these (Need input from Paul on how
  103. this should be done)
  104. ## 5) Build Stubs
  105. - from a clean/default environment maya gui, run:
  106. ```python
  107. import sys, os
  108. pymelPath = r'/Volumes/sv-dev01/devRepo/chad/pymel' # ...or wherever YOUR pymel version is installed
  109. if not os.path.isfile(os.path.join(pymelPath, 'pymel', '__init__.py')):
  110. raise RuntimeError('invalid pymel path: %s' % pymelPath)
  111. if sys.path[0] != pymelPath:
  112. sys.path.insert(0, pymelPath)
  113. import maintenance.stubs
  114. assert maintenance.__file__.startswith(pymelPath)
  115. reload(maintenance.stubs)
  116. maintenance.stubs.pymelstubs()
  117. ```
  118. - test the new stubs: from shell in the pymel base directory, do:
  119. ```
  120. python -c "import maintenance.stubs;maintenance.stubs.stubstest('./extras/completion/py')"
  121. ```
  122. be sure to run the test using the same major version of python as maya
  123. (2.6, 2.7, etc), so that any references to functions and classes in the
  124. standard library are found.
  125. ## 6) Update the Changelog
  126. - run changelog script:
  127. ./maintenance/changelog $PREVIOUS_PYMEL_VERSION $CURRENT_REVISION
  128. - the args are git tags or commit hashes. for example:
  129. ./maintenance/changelog 1.0.4 HEAD
  130. - copy results from resulting `maintenance/CHANGELOG.temp` file to `CHANGELOG.rst`
  131. - edit as necessary
  132. ## 7) Build Docs
  133. - WARNING: When I last attempted to build the docs on windows, the inheritance
  134. graphs were not generated properly, despite the fact that graphviz was
  135. installed, and the proper executable path was passed into
  136. `docs.build(graphviz_dot=...)`. As a result, I just ended up building the
  137. docs on Linux, where the graphs were generated correctly. Would like to
  138. track down why this isn't working on Windows at some point, but may just
  139. keep building the docs on Linux for now...
  140. - if you need to rebuild all the examples, delete `pymel/cache/mayaCmdsExamples.zip`.
  141. Be warned that the next step will cause your computer to freak out and
  142. possibly crash as it runs all of the examples from the Autodesk docs.
  143. Simply restart Maya and repeat until you get all the way through.
  144. - process new autodesk doc examples and add them to the examples cache:
  145. ```python
  146. import sys, os
  147. pymelPath = r'/Volumes/sv-dev01/devRepo/chad/pymel' # ...or wherever YOUR pymel version is installed
  148. if not os.path.isfile(os.path.join(pymelPath, 'pymel', '__init__.py')):
  149. raise RuntimeError('invalid pymel path: %s' % pymelPath)
  150. if sys.path[0] != pymelPath:
  151. sys.path.insert(0, pymelPath)
  152. os.environ['PYMEL_INCLUDE_EXAMPLES'] = 'True'
  153. import pymel.internal.cmdcache as cmdcache
  154. assert pymel.__file__.startswith(pymelPath)
  155. cmdcache.fixCodeExamples()
  156. ```
  157. - copy the list of internal commands provided by autodesk to `docs/internalCmds.txt`,
  158. or `docs/internalCommandList.txt`
  159. - turn of autoload for all plugins, so that pymel is not imported at startup
  160. (I haven't identified which plugins use pymel, but it includes mtoa and at
  161. least one other)
  162. - finally, to build the docs, from a clean/default environment maya gui
  163. *without pymel imported*, run:
  164. ```python
  165. import sys, os
  166. pymelPath = r'/Volumes/sv-dev01/devRepo/chad/pymel' # ...or wherever YOUR pymel version is installed
  167. if not os.path.isfile(os.path.join(pymelPath, 'pymel', '__init__.py')):
  168. raise RuntimeError('invalid pymel path: %s' % pymelPath)
  169. if sys.path[0] != pymelPath:
  170. sys.path.insert(0, pymelPath)
  171. import maintenance.docs as docs
  172. assert docs.__file__.startswith(pymelPath)
  173. docs.generate() # do this to ensure it cleans the generated source dir
  174. docs.build(graphviz_dot=None) #specify the location of dot executable if not on the PATH
  175. ```
  176. The `generate()` function uses the sphinx autosummary extension to generate
  177. stub `.rst` source files for each module listed in `index.rst`. The stub
  178. files contain `autosummary`, `autofunction`, and `autoclass` directives
  179. that tell sphinx to inspect the specified objects. These stub files are
  180. then read by sphinx when it is invoked the second time, by `build()`, at
  181. which point the `auto*` directives cause it to flesh out the documentation
  182. by inspecting live python objects, which it then writes out as html pages,
  183. one per `.rst`.
  184. ### Checking for Errors
  185. While building the docs sphinx will spit out a wall of errors between reading
  186. sources and writing html.
  187. TODO: write something to capture sphinx errors and filter known acceptable
  188. errors.
  189. Known Acceptable errors:
  190. - "ERROR: Unexpected indentation." : this is due to the trailing `..` used to
  191. create visual whitespace in the mel command tables. This might be better
  192. done using css...
  193. ### Rebuilding the Docs
  194. A few notes on rebuilding:
  195. - You only need to run `generate` a second time if the pymel source changes.
  196. - If you edit static docstrings you need to restart Maya (or reload the
  197. module) before rebuilding
  198. ## 8) Make Release
  199. - before releasing, make sure to tag the release (TODO: make this part of
  200. makerelease?):
  201. git tag -a 1.0.5rc1 -m "pymel release 1.0.5rc1"
  202. - then run the release script, on a linux or osx machine:
  203. ./maintenance/makerelease 1.0.5rc1
  204. - then make sure you push the tag!
  205. git push origin --tags