<commit_before>"""
This paver file is intended to help with the release process as much as
possible. It relies on virtualenv to generate 'bootstrap' environments as
independent from the user system as possible (e.g., to make sure the sphinx doc
is built against the built SciPy, not an installed one).

The release is assumed to be done on OS X. See release.sh for a script that
employs the Paver tasks defined in this file, and builds everything required
for a release at once.


Building a Windows installer from Wine
======================================

The Python version the installer is for can be specified with the ``-p 2.6``
switch (this works for all installer tasks). To build a simple (no SSE
instructions) installer, do::

    paver bdist_wininst_simple

This assumes that blas/lapack are in c:\local\lib inside drive_c. You will
have to make sure your Wine python locations (WINE_PYS) are configured
correctly.

The superpack requires all the Atlas libraries for every arch to be installed
(see SITECFG), and can then be built as follows::

    paver bdist_superpack


Building an installer for OS X
==============================

For a simple installer, which is just an mpkg inside a dmg, do::

  paver simple_dmg

For a more fancy installer, which includes documentation and looks better, do::

  paver pdf  # needs to be done only once
  paver dmg


Building changelog + notes
==========================

Assumes you have git and the binaries/tarballs in installers/::

    paver write_release_and_log

This automatically puts the checksum into NOTES.txt and writes the Changelog,
which can be uploaded to Github Releases (and maybe sourceforge for historical
reasons, see gh-4939).


TODO
====
    - make it more easily customizable (through command line args)
    - missing targets: install & test, sdist test, debian packaging
    - fix bdist_mpkg: we build the same source twice -> how to make sure we use
      the same underlying Python for egg install in venv and for bdist_mpkg
"""

import os
import sys
import subprocess
import re
import shutil
import warnings
from hashlib import md5
from hashlib import sha256

try:
    from paver.tasks import VERSION as _PVER
    if not _PVER >= '1.0':
        raise RuntimeError("paver version >= 1.0 required (was %s)" % _PVER)
except (ImportError, e):
    raise RuntimeError("paver version >= 1.0 required")

import paver
import paver.doctools
import paver.path
from paver.easy import options, Bunch, task, needs, dry, sh, call_task, cmdopts

sys.path.insert(0, os.path.dirname(__file__))
try:
    setup_py = __import__("setup")
    FULLVERSION = setup_py.VERSION
    # This is duplicated from setup.py
    if os.path.exists('.git'):
        GIT_REVISION = setup_py.git_version()
    else:
        GIT_REVISION = "Unknown"

    if not setup_py.ISRELEASED:
        if GIT_REVISION == "Unknown":
            FULLVERSION += '.dev0+Unknown'
        else:
            FULLVERSION += '.dev0+' + GIT_REVISION[:7]<commit_msg>Undefined name 'e' in pavement.py<commit_after>"""
This paver file is intended to help with the release process as much as
possible. It relies on virtualenv to generate 'bootstrap' environments as
independent from the user system as possible (e.g., to make sure the sphinx doc
is built against the built SciPy, not an installed one).

The release is assumed to be done on OS X. See release.sh for a script that
employs the Paver tasks defined in this file, and builds everything required
for a release at once.


Building a Windows installer from Wine
======================================

The Python version the installer is for can be specified with the ``-p 2.6``
switch (this works for all installer tasks). To build a simple (no SSE
instructions) installer, do::

    paver bdist_wininst_simple

This assumes that blas/lapack are in c:\local\lib inside drive_c. You will
have to make sure your Wine python locations (WINE_PYS) are configured
correctly.

The superpack requires all the Atlas libraries for every arch to be installed
(see SITECFG), and can then be built as follows::

    paver bdist_superpack


Building an installer for OS X
==============================

For a simple installer, which is just an mpkg inside a dmg, do::

  paver simple_dmg

For a more fancy installer, which includes documentation and looks better, do::

  paver pdf  # needs to be done only once
  paver dmg


Building changelog + notes
==========================

Assumes you have git and the binaries/tarballs in installers/::

    paver write_release_and_log

This automatically puts the checksum into NOTES.txt and writes the Changelog,
which can be uploaded to Github Releases (and maybe sourceforge for historical
reasons, see gh-4939).


TODO
====
    - make it more easily customizable (through command line args)
    - missing targets: install & test, sdist test, debian packaging
    - fix bdist_mpkg: we build the same source twice -> how to make sure we use
      the same underlying Python for egg install in venv and for bdist_mpkg
"""

import os
import sys
import subprocess
import re
import shutil
import warnings
from hashlib import md5
from hashlib import sha256

try:
    from paver.tasks import VERSION as _PVER
    if not _PVER >= '1.0':
        raise RuntimeError("paver version >= 1.0 required (was %s)" % _PVER)
except ImportError:
    raise RuntimeError("paver version >= 1.0 required")

import paver
import paver.doctools
import paver.path
from paver.easy import options, Bunch, task, needs, dry, sh, call_task, cmdopts

sys.path.insert(0, os.path.dirname(__file__))
try:
    setup_py = __import__("setup")
    FULLVERSION = setup_py.VERSION
    # This is duplicated from setup.py
    if os.path.exists('.git'):
        GIT_REVISION = setup_py.git_version()
    else:
        GIT_REVISION = "Unknown"

    if not setup_py.ISRELEASED:
        if GIT_REVISION == "Unknown":
            FULLVERSION += '.dev0+Unknown'
        else:
            FULLVERSION += '.dev0+' + GIT_REVISION[:7]
{'fraction_non_alphanumeric': 0.09347354364880654, 'fraction_numerical': 0.006676681689200467, 'mean_word_length': 3.81285140562249, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '558851', 'n_tokens_mistral': 1772, 'n_tokens_neox': 1673, 'n_words': 780}