Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into sym_pyobject
Browse files Browse the repository at this point in the history
  • Loading branch information
cbm755 committed May 19, 2017
2 parents 96114f5 + 27b1c81 commit 1d18f52
Show file tree
Hide file tree
Showing 303 changed files with 9,107 additions and 3,561 deletions.
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ temp_sym_python_cmd.py
inlog.txt
outlog.txt
octsympy_tests.log
fntests.log

# matlab package subdir
matlab/
# packaging subdir
tmp/

# autoconf
src/configure
Expand Down
21 changes: 21 additions & 0 deletions .mailmap
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Prevent git from showing duplicate names with commands like "git shortlog"
# See the manpage of git-shortlog for details.
# The syntax is:
# Name that should be used <email that should be used> Bad name <bad email>
#
# You can skip Bad name if it is the same as the one that should be used, and is unique.
#
# This file is up-to-date if the command git log --format="%aN <%aE>" | sort -u
# gives no duplicates.
Colin B. Macdonald <[email protected]> Colin Macdonald <[email protected]>
Colin B. Macdonald <[email protected]> Colin B. Macdonald <[email protected]>
Colin B. Macdonald <[email protected]> Colin Macdonald <[email protected]>
Abhinav Tripathi <[email protected]> Abhinav <[email protected]>
Abhinav Tripathi <[email protected]> <[email protected]>
Carnë Draug <[email protected]> carandraug <devnull@localhost>
Carnë Draug <[email protected]> <[email protected]>
John W. Eaton <[email protected]> jwe <devnull@localhost>
Mike Miller <[email protected]> <[email protected]>
Andrés Prieto <[email protected]> maprieto <[email protected]>
utkarsh <[email protected]> utkarsh <[email protected]>

70 changes: 45 additions & 25 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,49 +5,69 @@ language: generic

matrix:
include:
- python: "2.7"
env: PYTAVE=yes SYMPY_VER=1.0 OCT_PPA=yes DOCTEST=yes COLUMNS=80
- python: "2.7"
env: PYTAVE=no SYMPY_VER=1.0 OCT_PPA=yes DOCTEST=yes COLUMNS=80
- python: "3.5"
env: PYTAVE=no SYMPY_VER=1.0 OCT_PPA=yes DOCTEST=yes COLUMNS=80
- env: PYTHON=python2 PYTHON_VER= PYTAVE=no SYMPY_VER=1.0 OCT=ppa DOCTEST=yes COLUMNS=80
- env: PYTHON=python3 PYTHON_VER=3 PYTAVE=no SYMPY_VER=1.0 OCT=ppa DOCTEST=yes COLUMNS=80
- env: PYTHON=python2 PYTHON_VER= PYTAVE=no SYMPY_VER=1.0 OCT=daily DOCTEST=no COLUMNS=80
- env: PYTHON=python3 PYTHON_VER=3 PYTAVE=no SYMPY_VER=1.0 OCT=daily DOCTEST=no COLUMNS=80
- env: PYTHON=python2 PYTHON_VER= PYTAVE=yes SYMPY_VER=1.0 OCT=daily DOCTEST=no COLUMNS=80
- env: PYTHON=python3 PYTHON_VER=3 PYTAVE=yes SYMPY_VER=1.0 OCT=daily DOCTEST=no COLUMNS=80
allow_failures:
- env: PYTHON=python2 PYTHON_VER= PYTAVE=no SYMPY_VER=1.0 OCT=daily DOCTEST=no COLUMNS=80
- env: PYTHON=python3 PYTHON_VER=3 PYTAVE=no SYMPY_VER=1.0 OCT=daily DOCTEST=no COLUMNS=80
- env: PYTHON=python2 PYTHON_VER= PYTAVE=yes SYMPY_VER=1.0 OCT=daily DOCTEST=no COLUMNS=80
- env: PYTHON=python3 PYTHON_VER=3 PYTAVE=yes SYMPY_VER=1.0 OCT=daily DOCTEST=no COLUMNS=80

# need octave devel pkgs for doctest (has compiled code as of July 2015)
install:
- if [ "x$OCT_PPA" = "xyes" ]; then
before_install:
- if [ "x$OCT" = "xppa" ]; then
sudo apt-add-repository -y ppa:octave/stable;
fi
- sudo apt-get update -qq -y;
- sudo apt-get install -qq -y octave liboctave-dev;
- sudo apt-get install -qq -y python;
- "pip install --user sympy==$SYMPY_VER"
- sudo apt-get update -qq
- sudo apt-get install -y liboctave-dev
- sudo apt-get install -y octave
- if [ "x$OCT" = "xdaily" ]; then
sudo apt-get install -y libarpack2-dev libgl2ps-dev libgraphicsmagick++-dev libqrupdate-dev libsuitesparse-dev;
wget https://s3.amazonaws.com/octave-snapshot/public/octave-ubuntu-trusty-snapshot.tar.xz;
sudo tar --extract --directory=/usr/local --strip-components=1 --file=octave-ubuntu-trusty-snapshot.tar.xz;
fi
- sudo apt-get install -y python$PYTHON_VER-pip
# we need python-dev and python3-dev but we can drop numpy after https://bitbucket.org/mtmiller/pytave/issues/84 is resolved.
- if [ "x$PYTAVE" = "xyes" ]; then
sudo apt-get install -y python$PYTHON_VER-dev python$PYTHON_VER-numpy;
fi

install:
- pip$PYTHON_VER install --user sympy==$SYMPY_VER
- if [ "x$DOCTEST" = "xyes" ]; then
octave -W --no-gui --eval "pkg install -forge doctest";
mkdir ${HOME}/octave;
wget https://github.com/catch22/octave-doctest/releases/download/v0.5.0/doctest-0.5.0.tar.gz;
octave -W --no-gui --eval "pkg install doctest-0.5.0.tar.gz";
fi
- if [ "x$PYTAVE" = "xyes" ]; then
sudo apt-get install -qq -y libboost-python-dev python-numpy;
hg clone https://bitbucket.org/genuinelucifer/pytave_main;
cd pytave_main;
hg clone https://bitbucket.org/mtmiller/pytave pytave;
pushd pytave;
pwd;
autoreconf --install;
./configure;
make;
cd ..;
autoreconf --install || exit 1;
./configure PYTHON_VERSION=$PYTHON_VER && make || exit 1;
popd;
fi


# all commands here must have exit code 0 for the build to be called "passing"
# debugging: octave -W --no-gui --eval "syms x; A = [x sin(x) x^3]; A; exit(0)"
script:
- octave -W --no-gui --eval "ver; pwd; exit(0)"
- stty cols 80 rows 40
- stty cols $COLUMNS rows 40
- tput cols; stty size
- pushd src; make; popd
- pushd inst
- octave --path=/home/travis/build/cbm755/octsympy/pytave_main -W --no-gui --eval "r = octsympy_tests; exit(r)"
- if [ "x$PYTAVE" = "xyes" ]; then
export IPC=native;
else
export IPC=default;
fi
- octave --path=$TRAVIS_BUILD_DIR/pytave -W --no-gui --eval "sympref ipc $IPC; r = octsympy_tests; exit(r)";
- cat octsympy_tests.log
- if [ "x$DOCTEST" = "xyes" ]; then
octave --path=/home/travis/build/cbm755/octsympy/pytave_main -W --no-gui --eval "pkg load doctest; syms x; r = doctest('.'); exit(~r)";
octave --path=$TRAVIS_BUILD_DIR/pytave -W --no-gui --eval "pkg load doctest; sympref ipc $IPC; syms x; r = doctest('.'); exit(~r)";
fi
- popd

Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Eric Chassande-Mottin
Nicol N. Schraudolph
Sylvain Pelissier
Alex Vong
Marco Falke
NVS Abhilash

(Please contact the developers if your name should be here but isn't!)

Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: symbolic
Version: 2.4.0
Date: 2016-05-24
Version: 2.5.0
Date: 2017-02-01
Author: Colin B. Macdonald <[email protected]>
Maintainer: Colin B. Macdonald <[email protected]>
Title: Octave Symbolic Package using SymPy
Expand Down
38 changes: 12 additions & 26 deletions HOWTO-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,48 +15,38 @@ Checklist

- update version number (remove "-dev", check if bump needed).

- Make sure snippet defaults to false.

* Update DESCRIPTION file (version number and date).

* Update NEWS file (date, version number, reformat).

* Update version in src/configure.ac. Test the bootstrap script (note
the scripts below will run bootstrap for the packages).

* Check minimum sympy version is consistent: its in:
configure.ac, DESCRIPTION, assert_have_python_and_sympy.m
* Check minimum sympy version is consistent: its in
DESCRIPTION, assert_have_python_and_sympy.m

* Packages: need to run the following two scripts. I recommend
testing them first without using the tag. Then test the packages
by running the test suite.
* Packages: need to run the following two scripts:

- make_release_packages.sh, use "day-to-day testing" mode instead
of tag.
- Use the maintainer makefile: "make clean", "make dist".

- make_windows_package.sh, use "day-to-day testing" mode.
- make_windows_package.sh, use "day-to-day testing" mode. I
recommend testing them first without using the tag. Then test
the packages by running the test suite.

* Test regenerating the html documentation. Needs version >= 0.1.7.
- pkg load generate_html
- options = get_html_options ("octave-forge");
- generate_package_html ("symbolic", "html", options)
* Test regenerating html documentation: "make html"

* If packages seem ok, then tag the repo with:

`git tag -a v2.0.0 -m "Version 2.0.0"`
`git tag -a v2.x.y -m "Version 2.x.y"`

* `git push --tags origin master`. If messed up and want to change
anything after this, need to bump version number (tag is public).

* Push and push tags to sourceforge.

* Then redo the packages using the "tag" mode.
* Then redo the packages (Windows bundle will need "tag" mode).

- compute the md5sums, upload the packages to github release
page, and copy-paste the md5sums.

- regenerate the html documentation. It will create a directory
called "html". Then "tar -zcvf symbolic-html.tar.gz html".
- regenerate the html documentation.

- create ticket for binaries and doc tarball on sourceforge.

Expand All @@ -69,11 +59,7 @@ AFTER release
in sympref.m. See
[PEP 440](https://www.python.org/dev/peps/pep-0440).

* Update the version in src/configure.ac: -dev seems ok there.

* Optionally, update the make_*releases* scripts.
* Optionally, update the make_windows_bundle script.

* Leave old version in DESCRIPTION ("-dev" not supported here). We
will bump it at the next release. FIXME: this is unfortunate.

* Snippets could default to true in sympref.m
165 changes: 165 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
SHELL := /bin/bash

## Copyright 2016-2017 Colin B. Macdonald
##
## Copying and distribution of this file, with or without modification,
## are permitted in any medium without royalty provided the copyright
## notice and this notice are preserved. This file is offered as-is,
## without any warranty.

PACKAGE := $(shell grep "^Name: " DESCRIPTION | cut -f2 -d" ")
VERSION := $(shell grep "^Version: " DESCRIPTION | cut -f2 -d" ")
MATLAB_PACKAGE_NAME := octsympy

BUILD_DIR := tmp
MATLAB_PKG := ${BUILD_DIR}/${MATLAB_PACKAGE_NAME}-matlab-${VERSION}
MATLAB_PKG_ZIP := ${BUILD_DIR}/${MATLAB_PACKAGE_NAME}-matlab-${VERSION}.zip
OCTAVE_RELEASE := ${BUILD_DIR}/${PACKAGE}-${VERSION}
OCTAVE_RELEASE_TARBALL := ${BUILD_DIR}/${PACKAGE}-${VERSION}.tar.gz

INSTALLED_PACKAGE := ~/octave/${PACKAGE}-${VERSION}/packinfo/DESCRIPTION
HTML_DIR := ${BUILD_DIR}/${PACKAGE}-html
HTML_TARBALL := ${HTML_DIR}.tar.gz

OCTAVE ?= octave
MATLAB ?= matlab

.PHONY: help clean install test doctest dist dist_zip html matlab_test matlab_pkg

help:
@echo Available rules:
@echo " clean clean all temporary files"
@echo " install install package in Octave"
@echo " test run tests with Octave"
@echo " doctest run doctests with Octave"
@echo " dist create Octave package (${OCTAVE_RELEASE_TARBALL})"
@echo " html create Octave Forge website"
@echo
@echo " matlab_test run tests with Matlab"
@echo " matlab_pkg create Matlab package (${MATLAB_PKG_ZIP})"


GIT_DATE := $(shell git show -s --format=\%ci)
# Follows the recommendations of https://reproducible-builds.org/docs/archives
define create_tarball
$(shell cd $(dir $(1)) \
&& find $(notdir $(1)) -print0 \
| LC_ALL=C sort -z \
| tar c --mtime="$(GIT_DATE)" \
--owner=root --group=root --numeric-owner \
--no-recursion --null -T - -f - \
| gzip -9n > "$(2)")
endef

%.tar.gz: %
$(call create_tarball,$<,$(notdir $@))

%.zip: %
cd "$(BUILD_DIR)" ; zip -9qr - "$(notdir $<)" > "$(notdir $@)"

$(OCTAVE_RELEASE): .git/index | $(BUILD_DIR)
@echo "Creating package version $(VERSION) release ..."
-$(RM) -r "$@"
git archive --format=tar --prefix="$@/" HEAD | tar -x
$(RM) "$@/README.matlab.md" \
"$@/HOWTO-release.md" \
"$@/README.bundled.md" \
"$@/TODO.md" \
"$@/.gitignore" \
"$@/.travis.yml" \
"$@/.mailmap" \
"$@/screenshot.png" \
"$@/screenshot-install.png"
$(RM) -r "$@/testing" "$@/util"
chmod -R a+rX,u+w,go-w "$@"

$(HTML_DIR): install | $(BUILD_DIR)
@echo "Generating HTML documentation. This may take a while ..."
-$(RM) -r "$@"
$(OCTAVE) --no-window-system --silent \
--eval "pkg load generate_html; " \
--eval "pkg load $(PACKAGE);" \
--eval "options = get_html_options ('octave-forge');" \
--eval "generate_package_html ('${PACKAGE}', '${HTML_DIR}', options)"
chmod -R a+rX,u+w,go-w $@

dist: $(OCTAVE_RELEASE_TARBALL)
html: $(HTML_TARBALL)

${BUILD_DIR} ${MATLAB_PKG}/private ${MATLAB_PKG}/tests_matlab ${MATLAB_PKG}/@sym ${MATLAB_PKG}/@symfun ${MATLAB_PKG}/@logical ${MATLAB_PKG}/@double:
mkdir -p "$@"

clean:
rm -rf "${BUILD_DIR}"
@#rm -f fntests.log
rm -f inst/octsympy_tests.log

test:
@echo "Testing package in GNU Octave ..."
@$(OCTAVE) --no-gui --silent --path "${PWD}/inst" \
--eval "set (0, 'defaultfigurevisible', 'off'); \
anyfail = octsympy_tests; \
sympref reset; \
exit (anyfail)"
@echo

doctest:
@# Workaround for OctSymPy issue 273, we must pre-initialize the package
@# Otherwise, it will make the doctests fail
@echo "Testing documentation strings ..."
@$(OCTAVE) --no-gui --silent --path "${PWD}/inst" \
--eval "pkg load doctest; \
sym ('x'); \
set (0, 'defaultfigurevisible', 'off'); \
success = doctest('inst/'); \
sympref reset; \
exit (!success)"
@echo


## Install in Octave (locally)
install: ${INSTALLED_PACKAGE}
${INSTALLED_PACKAGE}: ${OCTAVE_RELEASE_TARBALL}
$(OCTAVE) --silent --eval "pkg install $<"

## Matlab packaging
## TODO: should be written to properly use artfacts
matlab_pkg: $(MATLAB_PKG_ZIP)

${MATLAB_PKG}: $(BUILD_DIR) ${MATLAB_PKG}/private ml_extract_tests

## Matlab: extract unit tests from Octave files, place in separate files
ml_extract_tests: ${MATLAB_PKG}/tests_matlab ml_copy
cp -pR misc/octassert.m ${MATLAB_PKG}/tests_matlab/
cp -pR misc/extract_tests_for_matlab.m ${MATLAB_PKG}/
cp -pR misc/octsympy_tests_matlab.m ${MATLAB_PKG}/
cd ${MATLAB_PKG}/; ${OCTAVE} -q --eval "extract_tests_for_matlab"
rm -f ${MATLAB_PKG}/extract_tests_for_matlab.m
rm -f ${MATLAB_PKG}/tests_matlab/tests__sympref.m # temp

## Matlab: copy files
ml_copy: ml_convert_comments
cp -pR inst/private ${MATLAB_PKG}/
cp -pR inst/@sym/private ${MATLAB_PKG}/@sym/
cp -pR inst/@symfun/private ${MATLAB_PKG}/@symfun/
cp -pR misc/my_print_usage.m ${MATLAB_PKG}/private/print_usage.m
cp -pR misc/my_print_usage.m ${MATLAB_PKG}/@sym/private/print_usage.m
cp -pR misc/my_print_usage.m ${MATLAB_PKG}/@symfun/private/print_usage.m
cp -fp CONTRIBUTORS ${MATLAB_PKG}/
cp -fp NEWS ${MATLAB_PKG}/
cp -fp COPYING ${MATLAB_PKG}/
cp -fp matlab_smt_differences.md ${MATLAB_PKG}/
cp -fp README.md ${MATLAB_PKG}/
cp -fp README.matlab.md ${MATLAB_PKG}/
rm -f ${MATLAB_PKG}/octsympy_tests.m

## Matlab: extract and convert comments to Matlab style
ml_convert_comments: ${MATLAB_PKG}/@sym ${MATLAB_PKG}/@symfun ${MATLAB_PKG}/@double ${MATLAB_PKG}/@logical
$(OCTAVE) --path ${PWD}/util --silent --eval "pwd, convert_comments('inst/', '', '../${MATLAB_PKG}/')"
$(OCTAVE) --path ${PWD}/util --silent --eval "pwd, convert_comments('inst/', '@symfun', '../${MATLAB_PKG}/')"
$(OCTAVE) --path ${PWD}/util --silent --eval "pwd, convert_comments('inst/', '@sym', '../${MATLAB_PKG}/')"
$(OCTAVE) --path ${PWD}/util --silent --eval "pwd, convert_comments('inst/', '@double', '../${MATLAB_PKG}/')"
$(OCTAVE) --path ${PWD}/util --silent --eval "pwd, convert_comments('inst/', '@logical', '../${MATLAB_PKG}/')"

matlab_test:
${MATLAB} -nojvm -nodisplay -nosplash -r "addpath('inst'); octsympy_tests_matlab"
Loading

0 comments on commit 1d18f52

Please sign in to comment.