Abjad packaging checklist:

 1. Open abjad/etc/packaging_transcript.txt.

 2.  Document the packaging environment in the packaging transcript.

    (a) Apply any OS updates to the machine on which you will produce 
        the package.

    (b) Decide whether to upgrade git.

    (c) If necessary, upgrade Python on the packaging machine.
        Python upgrade procedures are OS-dependent.

    (d) Update pip with "sudo pip install --upgrade pip".

    (e) Update py.test with "sudo pip install --upgrade pytest".

    (f) Update Sphinx with "sudo pip install --upgrade Sphinx".

    (g) Visit www.lilypond.org.
        Decide whether to update LilyPond.

    (h) Visit http://www.imagemagick.org/script/binary-releases.php.
        Decide whether to update ImageMagick.
    
    (i) Visit www.graphviz.org.
        Decide whether to update Graphviz.

    (j) Run scr/devel/make-packaging-transcript.py
        Copy the results into abjad/etc/packaging_transcript.txt
        Update "workstation description" manually.
        The other packaging environment entries should already be present.

 3. Run the following codebase maintenance scripts:
        find-duplicate-module-names (mainline only)
        find-file-names-with-forbidden-characters (both)
        find-import-as-statements (both)
        find-import-from-stdlib-statements (both)
        find-lower-camel-case-definitions (both)
        find-lower-camel-case-modules (both)
        find-manual-initializers (mainline only)
        find-multifunction-modules (both)
        find-nonalphabetized-class-attributes (both)
        find-private-functions-in-public-modules (both)
        find-private-modules (both)
        find-slots-inconsistencies (each separately)
    Also run these:
        fix-block-comments (both)
        fix-tests (both)
        ensure-source-file-terminal-blank-lines (both)
    This script should eventually be ported forward:
        find-nonalphabetized-module-headers
    Test and commit. Alternately you may want to test after each script runs.
    Then test and commit.

 4. Change to the abjad root directory, then to ly/ly and run `make all`.
    This will update the parser's LilyPond environment scrape to the current
    version of LilyPond in use in the packaging environment.
    If any part of the scrape fails to compile, fix, commit and repeat this
    step.

    Note: updating the LilyPond scrape may need to be delayed until Abjad's
    LilyPond parser can be brought in-line with many of LilyPond's internal
    changes since 2.16.

 5. Change to the abjad mainline root directory.
    Run "ajv clean .".
    Then run "py.test".
    If any tests break, fix, commit and repeat this step.
    Record mainline py.test test results in the packaging transcript.

 6. Change back to the abjad root directory and run "ajv api -M".
    You will need Graphviz installed to build the API.
    OS X Graphviz downloads are available at 
        http://www.graphviz.org/Download..php.
    Ubuntu Graphic installation is available with 
        "sudo apt-get install graphviz".
    The HTML version of the API should build with no warnings and no errors.
    If Sphinx gives any warnings or errors, fix, commit and go back to (7.)

 7. Change to abjad/tools.
    Run "ajv doctest".
    If any tests break, fix, commit and go back to (7.).
    Record mainline doctest test results in the packaging transcript.

 8. Change to the experimental directory.
    Run "ajv clean .".
    Then run "py.test".
    If any tests break, fix, commit and go back to (7.).
    Record experimental py.test results in the packaging transcript.

 9. Stay in the experimental directory.
    Run "ajv doctest".
    If any tests break, fix, commit and go back to (7.).
    Record experimental doctest test results in the packaging transcript.

10. Return to the mainline.
    Start the Abjad interpreter to run one final sanity check.
    Run '''show(Note("c'4"))'''.
    Then call:
        systemtools.IOManager.open_last_ly()
        systemtools.IOManager.open_last_log()
        systemtools.IOManager.open_last_pdf()
    Then run '''play(Note("c'4"))'''.
    Then run '''graph(Staff("c'4"))'''.
    If any test fails, fix, commit and go back to (7.)
    Record sanity check test results in the packaging transcript.

#11. Change to the abjad/etc/optimization directory.
#    Create a v2.x optimization transcript by copying the most recent such file.
#    Record memory usage and profiling test results in the 
#    optimization transcript.

#12. Run "svn info".
#    Note the current revision of the working copy you are packaging.
#    Open docs/source/start_here/versions/index.rst again.
#    Check the release date indicated there.
#    Check the revision number indicated there.
#    Make sure the revision number equals current revision + 1.

13. Author release notes:
        Open docs/source/start_here/versions/index.rst.
        Example: "Released 2009-05-21. Built from r5752."
        Change to abjad/tools.
        Run "ajv count tools ." and "scr/devel/count-source-lines".
        Add a sentence detailing the output of these scripts to this chapter.
        Example: "Implements 405 public classes and 1066 functions 
        totaling 182,000 lines of code."
        Run whatever git command will present past commits.
            git log REVISIONNUMBER.. --reverse
        Read log and write release notes.
        Follow the pattern already established in the document.
        List new features and functionality.
        Highlight significant new functionality with a musical example.
        Begin entries with an active verb in the simple past.
        Order entries by leading verb.
        List adds first and extensions second.
        List changes in user syntax last.
    Also update change log:
        Open docs/source/appendices/change_log/index.rst 
        Add entries for function, method and class names changed 
        during development.
    Commit.

14. Change to abjad/docs.
    Run 'make clean'.
    This step is important because failing to 'make clean' before building
    the docs can cause the doc tarball made below to be too large.

15. Change to experimental/docs.
    Run "make clean".
    Run "avj api -X". If any erros occur, fix, commit and go back to (7.)
    Record experimental HTML build results in the packaging transcript.

16. Change back to abjad/docs.
    Run "ajv api -M". If any errors occur, fix, commit and go back to (7.)
    Record mainline HTML build results in the packaging transcript.

#17. Run "make latex". 
#    If any errors occur, fix, commit and go back to (7.)
#    Record LaTeX build results in the packaging transcript.

#18. Run "make latexpdf". 
#    If any errors occur, fix, commit and go back to (7.)
#    Open the docs/build/latex/Abjad.pdf file that results.
#    Click around some to make sure everything looks OK.
#    Record Abjad.pdf build results in the packaging transcript.
#    Open the docs/build/latex/AbjadAPI.pdf file that also results.
#    Click around some to make sure everything looks OK.
#    Record AbjadAPI.pdf build results in the packaging transcript.

#19. Copy docs/build/latex/Abjad.pdf to docs/pdf/Abjad-x-y.pdf.
#    Copy docs/build/latex/AbjadAPI.pdf to docs/pdf/AbjadAPI-x-y.pdf.
#    Do both of these with 'cp' and not with 'svn cp'.

#20. Add docs/pdf/Abajd-x-y.pdf to svn.
#    Add docs/pdf/AbjadAPI-x-y.pdf to svn.

#21. Remove docs/pdf/Abjad-x-(y-1).pdf from svn.
#    Remove docs/pdf/AbjadAPI-x-(y-1).pdf from svn.

22. Commit.
    All tests have now passed in the packaging environment.
    All documentation has now built in the packaging environment.

#23. For each additional test environment, repeat the following steps:
#    [2] documenting the test environment.
#    [5], [6], [7] recording py.test, doctest and sanity check test results.
#    [12], [13], [14] recording HTML, LaTeX & PDF build results.

24. Complete all addition platform testing.
    Close and save the packaging transcript.
    Commit.

#25. Change to abjad/trunk.
#    Upgrade setuptools with "sudo pip install --upgrade setuptools".

26. Run 'python setup.py register sdist upload'
    Follow the login instructions provided by PyPI.
    You must have Abjad package owner credentials for this step to work.
    If you need Abjad package owner credentials, 
    talk to Trevor, Josiah or Víctor.
    PyPI should respond with "Server response (200): OK".

27. Remove 'dist' and 'Abjad.egg-info'.
    The directories are no longer needed after upload to PyPI.
    The directories should not be checked into the Abjad repository.

28. Log in to The PyPI website at pypi.python.org with Abjad owner credentials.
    Talk to Trevor, Josiah or Víctor if you need Abjad owner credentials.
    Click on the Abjad link to edit PyPI's information about the package.

29. Click your browser's "back" button to return to the 
    "Package 'Abjad' Editing" page.
    Then click on the "edit" link to the left of the entry for the new version.
    This will take you to the "Submitting package information" page.

30. Manually restore the spaces after each of the keyword phrases in
    "music composition, music notation, formalized score control, lilypond"
    in the "Keywords" field. (setup.py mangles these on upload to PyPI.)

31. Click the "Add information" button at the bottom of the page to confirm.
    All PyPI editing and uploading is now complete.

32. Click around PyPI to make sure everything looks correct.
    Then leave PyPI.
    
33. Edit _version.py and increment __version_info__ to the *next* minor
    number.

34. Commit.

35. Author release announcement and mail to abjad-user@googlegroups.com.
    Release announcement should recapitulate version history.
    
[2011-08-21, 2011-08-30, 2011-09-12, 2011-09-22, 
 2012-01-29, 2012-02-27, 2012-05-22, 2012-06-05, 
 2012-10-03, 2012-10-05, 2012-10-29, 2012-12-17, 
 2013-03-25, 2013-10-23, 2013-12-26, 2014-08-08]
