<commit_before>language: python
python:
  - "2.7"
  - "3.2"
# 3.3 doesn't work for some weird reason, it has issues activating the
# virtualenv. Bug in Travis-CI?
#  - "3.3"
# 3.4 doesn't appear to be available on Travis-CI, despite it being listed at
# http://docs.travis-ci.com/user/languages/python/
#  - "3.4"


env:
    matrix:
        # Basic build only running nosetests, one using apt and one running in
        # a virtualenv.
        - INSTALL=venv UPGRADE=false
        - INSTALL=apt UPGRADE=false
        # Test upgrade by first installing stable package from official repo
        # and then build and upgrade to new packages. Not applicable to
        # virtualenv since the upgrade process specifically tests the apt
        # package upgrade procedure.
        - INSTALL=apt UPGRADE=true

matrix:
    # NIPAP is not Python 3 compliant yet, so we allow failures
    allow_failures:
        - python: "3.2"

    # don't wait for the above jobs, which are allowed to fail, before marking
    # the whole build complete
    fast_finish: true

    # Ubuntu doesn't come with python3 dependencies through apt, so we can't
    # test anything but in a virtualenv.
    exclude:
        - python: "3.2"
          env: INSTALL=apt UPGRADE=true
        - python: "3.2"
          env: INSTALL=apt UPGRADE=false

virtualenv:
    system_site_packages: true

install:
    # -- common operations to apt install and virtualenv -----------------------
    # install dependencies for building packages and build NIPAP debian packages
    - sudo apt-get update
    - sudo apt-get install -qq -y --force-yes devscripts python-docutils
    # configure .nipaprc
    - sed -e 's/username = guest/username = unittest/' -e 's/password = guest/password = <PASSWORD>/' nipap-cli/nipaprc > ~/.nipaprc
    - chmod 0600 ~/.nipaprc

    # -- virtualenv build ------------------------------------------------------
    # install nipap dependencies
    - if [ "$INSTALL" == "venv" ]; then pip install -r nipap/requirements.txt; fi
    # install postgresql module (can't get from pip).
    # TODO: so weird; ldap doesn't work through pip...
    - if [ "$INSTALL" == "venv" ]; then sudo apt-get install -qq -y python-ldap postgresql-9.1-ip4r; fi
    # SQL
    - if [ "$INSTALL" == "venv" ]; then sudo su -c "cd nipap/sql; make install" postgres; fi
    # move configuration file into place
    - if [ "$INSTALL" == "venv" ]; then sudo mkdir /etc/nipap; sudo cp nipap/nipap.conf.dist /etc/nipap/nipap.conf; fi
    # create local user for unittest
    - if [ "$INSTALL" == "venv" ]; then sudo nipap/nipap-passwd --create-database; sudo nipap/nipap-passwd -a unittest -p gottatest -n unittest; fi
    - if [ "$INSTALL" == "venv" ]; then sudo nipap/nipap-passwd -a readonly -p gottatest --readonly -n "Read-only user for running unit tests"; fi
    # install pynipap
    - if [ "$INSTALL" == "venv" ]; then cd pynipap; python setup.py install; cd ..; fi
    # start nipap backend
    - if [ "$INSTALL" == "venv" ]; then nipap/nipapd --no-pid-file -c nipap/nipap.conf.dist; fi

    # -- APT build --------------------------------------------------------------
    # add NIPAP official Debian repo and keys, we use it to get ip4r
    - if [ "$INSTALL" == "apt" ]; then echo "deb http://spritelink.github.io/NIPAP/repos/apt stable main extra" | sudo tee /etc/apt/sources.list.d/nipap.list; fi
    - if [ "$INSTALL" == "apt" ]; then wget -O - https://spritelink.github.io/NIPAP/nipap.gpg.key | sudo apt-key add -; fi
    - if [ "$INSTALL" == "apt" ]; then sudo apt-get update -qq; fi
    # install dependencies for installing & running nipap
    - if [ "$INSTALL" == "apt" ]; then sudo apt-get install -qq -y --force-yes python-pysqlite2 python-psycopg2 python-ipy python-ldap python-docutils postgresql-9.1 postgresql-9.1-ip4r python-tornado python-flask python-flask-xml-rpc python-flask-compress python-parsedatetime python-tz python-dateutil python-psutil; fi
    # if we are testing the upgrade, first install NIPAP packages from official repo
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then sudo apt-get install -qq nipapd nipap-www nipap-cli; fi
    # bump version so that we know we are upgrading beyond what is installed
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then (echo -e 'Version 9999.9.9\n------------------\n * Test version for Travis-CI automatic upgrade test'; cat NEWS) > NEWS2; mv NEWS2 NEWS; make bumpversion; fi
    # populate answers to nipapd package install questions and reconfigure
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then echo 'set nipapd/autoconf true' | sudo debconf-communicate; echo 'set nipapd/startup true' | sudo debconf-communicate; echo 'set nipapd/upgrade true' | sudo debconf-communicate; sudo dpkg-reconfigure nipapd; fi
    # create local user for unittest and restart
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then sudo nipap/nipap-passwd -f /etc/nipap/local_auth.db -a unittest -p gottatest -n unittest; sudo /etc/init.d/nipapd restart; fi
    # if upgrade, add some data to the database that we can verify later
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then nosetests tests/upgrade-before.py; fi
    # build new NIPAP packages
    - if [ "$INSTALL" == "apt" ]; then make builddeb; fi
    # install the newly built nipap packages
    - if [ "$INSTALL" == "apt" ]; then sudo dpkg -i nipap*.deb python-pynipap*.deb; fi
    # populate answers to nipapd package install questions and reconfigure
    - if [ "$INSTALL" == "apt" ]; then echo "set nipapd/autoconf true" | sudo debconf-communicate; fi
    - if [ "$INSTALL" == "apt" ]; then echo "set nipapd/startup true" | sudo debconf-communicate; fi
    # reconfigure to do bootstrapping of db and stuff, unless we are trying
    # upgrade in which case this will upgrade everything for us
    - if [ "$INSTALL" == "apt" ]; then sudo dpkg-reconfigure nipapd; fi
    # create local user for unittests
    - if [ "$INSTALL" == "apt" ]; then sudo nipap/nipap-passwd -f /etc/nipap/local_auth.db -a unittest -p gottatest -n "User for running unit tests"; fi
    - if [ "$INSTALL" == "apt" ]; then sudo nipap/nipap-passwd -f /etc/nipap/local_auth.db -a readonly -p gottatest --readonly -n "Read-only user for running unit tests"; fi
    # Don't need to restart, but I would like to make sure that all is updated
    # (like local_auth.db is re-read and so forth). Read #654 for more
    # information.
    #- if [ "$INSTALL" == "apt" ]; then sudo /etc/init.d/nipapd restart; fi

script:
    - cd tests
    # if upgrade, verify data loaded before upgrade looks correct post upgrade
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then nosetests upgrade-after.py; fi
    - nosetests xmlrpc.py
    - nosetests nipaptest.py
    - nosetests test_cli.py
    - nosetests nipap-ro.py

notifications:
    irc:
        channels:
            # secure variable to prevent forks of NIPAP to send notifications to our IRC channel
            # irc.freenode.org#NIPAP
            - secure: "<KEY>
        skip_join: true
<commit_msg>Temporarily disable debian upgrade test<commit_after>language: python
python:
  - "2.7"
  - "3.2"
# 3.3 doesn't work for some weird reason, it has issues activating the
# virtualenv. Bug in Travis-CI?
#  - "3.3"
# 3.4 doesn't appear to be available on Travis-CI, despite it being listed at
# http://docs.travis-ci.com/user/languages/python/
#  - "3.4"


env:
    matrix:
        # Basic build only running nosetests, one using apt and one running in
        # a virtualenv.
        - INSTALL=venv UPGRADE=false
        - INSTALL=apt UPGRADE=false
        # Test upgrade by first installing stable package from official repo
        # and then build and upgrade to new packages. Not applicable to
        # virtualenv since the upgrade process specifically tests the apt
        # package upgrade procedure.
        - INSTALL=apt UPGRADE=true

matrix:
    # NIPAP is not Python 3 compliant yet, so we allow failures
    allow_failures:
        - env: INSTALL=apt UPGRADE=true
        - python: "3.2"

    # don't wait for the above jobs, which are allowed to fail, before marking
    # the whole build complete
    fast_finish: true

    # Ubuntu doesn't come with python3 dependencies through apt, so we can't
    # test anything but in a virtualenv.
    exclude:
        - python: "3.2"
          env: INSTALL=apt UPGRADE=true
        - python: "3.2"
          env: INSTALL=apt UPGRADE=false

virtualenv:
    system_site_packages: true

install:
    # -- common operations to apt install and virtualenv -----------------------
    # install dependencies for building packages and build NIPAP debian packages
    - sudo apt-get update
    - sudo apt-get install -qq -y --force-yes devscripts python-docutils
    # configure .nipaprc
    - sed -e 's/username = guest/username = unittest/' -e 's/password = guest/password = <PASSWORD>/' nipap-cli/nipaprc > ~/.nipaprc
    - chmod 0600 ~/.nipaprc

    # -- virtualenv build ------------------------------------------------------
    # install nipap dependencies
    - if [ "$INSTALL" == "venv" ]; then pip install -r nipap/requirements.txt; fi
    # install postgresql module (can't get from pip).
    # TODO: so weird; ldap doesn't work through pip...
    - if [ "$INSTALL" == "venv" ]; then sudo apt-get install -qq -y python-ldap postgresql-9.1-ip4r; fi
    # SQL
    - if [ "$INSTALL" == "venv" ]; then sudo su -c "cd nipap/sql; make install" postgres; fi
    # move configuration file into place
    - if [ "$INSTALL" == "venv" ]; then sudo mkdir /etc/nipap; sudo cp nipap/nipap.conf.dist /etc/nipap/nipap.conf; fi
    # create local user for unittest
    - if [ "$INSTALL" == "venv" ]; then sudo nipap/nipap-passwd --create-database; sudo nipap/nipap-passwd -a unittest -p gottatest -n unittest; fi
    - if [ "$INSTALL" == "venv" ]; then sudo nipap/nipap-passwd -a readonly -p gottatest --readonly -n "Read-only user for running unit tests"; fi
    # install pynipap
    - if [ "$INSTALL" == "venv" ]; then cd pynipap; python setup.py install; cd ..; fi
    # start nipap backend
    - if [ "$INSTALL" == "venv" ]; then nipap/nipapd --no-pid-file -c nipap/nipap.conf.dist; fi

    # -- APT build --------------------------------------------------------------
    # add NIPAP official Debian repo and keys, we use it to get ip4r
    - if [ "$INSTALL" == "apt" ]; then echo "deb http://spritelink.github.io/NIPAP/repos/apt stable main extra" | sudo tee /etc/apt/sources.list.d/nipap.list; fi
    - if [ "$INSTALL" == "apt" ]; then wget -O - https://spritelink.github.io/NIPAP/nipap.gpg.key | sudo apt-key add -; fi
    - if [ "$INSTALL" == "apt" ]; then sudo apt-get update -qq; fi
    # install dependencies for installing & running nipap
    - if [ "$INSTALL" == "apt" ]; then sudo apt-get install -qq -y --force-yes python-pysqlite2 python-psycopg2 python-ipy python-ldap python-docutils postgresql-9.1 postgresql-9.1-ip4r python-tornado python-flask python-flask-xml-rpc python-flask-compress python-parsedatetime python-tz python-dateutil python-psutil; fi
    # if we are testing the upgrade, first install NIPAP packages from official repo
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then sudo apt-get install -qq nipapd nipap-www nipap-cli; fi
    # bump version so that we know we are upgrading beyond what is installed
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then (echo -e 'Version 9999.9.9\n------------------\n * Test version for Travis-CI automatic upgrade test'; cat NEWS) > NEWS2; mv NEWS2 NEWS; make bumpversion; fi
    # populate answers to nipapd package install questions and reconfigure
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then echo 'set nipapd/autoconf true' | sudo debconf-communicate; echo 'set nipapd/startup true' | sudo debconf-communicate; echo 'set nipapd/upgrade true' | sudo debconf-communicate; sudo dpkg-reconfigure nipapd; fi
    # create local user for unittest and restart
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then sudo nipap/nipap-passwd -f /etc/nipap/local_auth.db -a unittest -p gottatest -n unittest; sudo /etc/init.d/nipapd restart; fi
    # if upgrade, add some data to the database that we can verify later
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then nosetests tests/upgrade-before.py; fi
    # build new NIPAP packages
    - if [ "$INSTALL" == "apt" ]; then make builddeb; fi
    # install the newly built nipap packages
    - if [ "$INSTALL" == "apt" ]; then sudo dpkg -i nipap*.deb python-pynipap*.deb; fi
    # populate answers to nipapd package install questions and reconfigure
    - if [ "$INSTALL" == "apt" ]; then echo "set nipapd/autoconf true" | sudo debconf-communicate; fi
    - if [ "$INSTALL" == "apt" ]; then echo "set nipapd/startup true" | sudo debconf-communicate; fi
    # reconfigure to do bootstrapping of db and stuff, unless we are trying
    # upgrade in which case this will upgrade everything for us
    - if [ "$INSTALL" == "apt" ]; then sudo dpkg-reconfigure nipapd; fi
    # create local user for unittests
    - if [ "$INSTALL" == "apt" ]; then sudo nipap/nipap-passwd -f /etc/nipap/local_auth.db -a unittest -p gottatest -n "User for running unit tests"; fi
    - if [ "$INSTALL" == "apt" ]; then sudo nipap/nipap-passwd -f /etc/nipap/local_auth.db -a readonly -p gottatest --readonly -n "Read-only user for running unit tests"; fi
    # Don't need to restart, but I would like to make sure that all is updated
    # (like local_auth.db is re-read and so forth). Read #654 for more
    # information.
    #- if [ "$INSTALL" == "apt" ]; then sudo /etc/init.d/nipapd restart; fi

script:
    - cd tests
    # if upgrade, verify data loaded before upgrade looks correct post upgrade
    - if [ "$INSTALL" == "apt" ] && [ "$UPGRADE" == "true" ]; then nosetests upgrade-after.py; fi
    - nosetests xmlrpc.py
    - nosetests nipaptest.py
    - nosetests test_cli.py
    - nosetests nipap-ro.py

notifications:
    irc:
        channels:
            # secure variable to prevent forks of NIPAP to send notifications to our IRC channel
            # irc.freenode.org#NIPAP
            - secure: "<KEY>
        skip_join: true

{'fraction_non_alphanumeric': 0.140331181588549, 'fraction_numerical': 0.006455234353073253, 'mean_word_length': 2.632262996941896, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, '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': '6143838', 'n_tokens_mistral': 4780, 'n_tokens_neox': 4505, 'n_words': 1593}