Commit c2ba439a authored by Julien Lamy's avatar Julien Lamy
Browse files

New upstream version v0.10.0

parent 9d0e6659
Loading
Loading
Loading
Loading
+3 −13
Original line number Diff line number Diff line
@@ -5,20 +5,14 @@ set -ev
export Python=${Python:?}
export WORKSPACE=${WORKSPACE:?}

PYTHON_EXECUTABLE="/usr/local/bin/python${Python}"
PYTHON_PREFIX=$(${PYTHON_EXECUTABLE} -c 'import sys;print(sys.prefix)')
PYTHON_VERSION="$(${PYTHON_EXECUTABLE} -c 'import sys;print(sys.version[:3])')"
PYTHON_VERSION_NO_DOT=$(echo ${PYTHON_VERSION} | sed 's/\.//')
PYTHON_INCLUDE_DIR=$(${PYTHON_EXECUTABLE} -c 'from distutils import sysconfig;print(sysconfig.get_python_inc(True))')
PYTHON_LIBRARY=${PYTHON_PREFIX}/lib/libpython${PYTHON_VERSION}.dylib

if [ "${Python}" = "2" ]
then
    Boost_PYTHON_LIBRARY=/usr/local/lib/libboost_python.dylib
  PYTHON_EXECUTABLE="/usr/local/opt/python@2/bin/python2.7"
else
    Boost_PYTHON_LIBRARY=/usr/local/lib/libboost_python${PYTHON_VERSION_NO_DOT}.dylib
  PYTHON_EXECUTABLE="/usr/local/bin/python3"
fi


mkdir build
mkdir install
cd build
@@ -28,10 +22,6 @@ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/opt/icu4c/lib/pkgconf
cmake \
  -D CMAKE_INSTALL_PREFIX="${WORKSPACE}/install" \
  -D PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} \
  -D PYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR} \
  -D PYTHON_LIBRARY=${PYTHON_LIBRARY} \
  -D Boost_PYTHON_LIBRARY_DEBUG=${Boost_PYTHON_LIBRARY} \
  -D Boost_PYTHON_LIBRARY_RELEASE=${Boost_PYTHON_LIBRARY} \
  ${CMAKE_OPTIONS} \
  ..
make ${MAKE_OPTIONS} install
+26 −22
Original line number Diff line number Diff line
@@ -9,43 +9,47 @@ import sys

brew_conflicting = ["json-c"]
brew_required = [
    "boost", "boost-python", "boost-python3", "cmake", "cppcheck", "dcmtk",
    "icu4c", "jsoncpp", "lcov", "log4cpp", "pkg-config", "python", "python@2"
    "boost", "cmake", "dcmtk", "icu4c", "jsoncpp", "pkg-config", "pybind11"
]
brew_required.append(
    "python{}".format("@2" if os.environ["Python"] == 2 else ""))

pip_required = ["cpp-coveralls", "nose"]
pip_required = ["nose"]

for formula in brew_conflicting:
def get_formula_info(formula):
    try:
        info = json.loads(
            subprocess.check_output(["brew", "info", "--json=v1", formula]))
    except subprocess.CalledProcessError:
        return None

    if len(info) > 1:
        print("Too many formulas matching {}".format(formula))
        sys.exit(1)
    elif len(info) == 0:
        continue
    installed = (len(info[0]["installed"]) != 0)
    if installed:
        return None
    else:
        return info[0]

for formula in brew_conflicting:
    info = get_formula_info(formula)
    if info is not None and info["installed"]:
        print("Removing conflicting formula: {}".format(formula))
        subprocess.check_call(["brew", "unlink", formula])

for formula in brew_required:
    info = json.loads(
        subprocess.check_output(["brew", "info", "--json=v1", formula]))
    if len(info) > 1:
        print("Too many formulas matching {}".format(formula))
        sys.exit(1)
    elif len(info) == 0:
        print("No formula matching {}".format(formula))
        sys.exit(1)
    info = get_formula_info(formula)
    if info is None:
        raise Exception("No such formula: {}".format(formula))

    action = None
    if len(info[0]["installed"]) == 0:
    if not info["installed"]:
        action = "install"
    elif info[0]["installed"][-1]["version"] != info[0]["versions"]["stable"]:
    elif not info["installed"][-1]["version"].startswith(info["versions"]["stable"]):
        action = "upgrade"

    if action is not None:
        subprocess.check_call(["brew", action, formula])

subprocess.check_call(
    ["pip"+os.environ["Python"], "install", "--user", "-U"]+pip_required)
    ["pip"+os.environ["Python"], "install", "-U"]+pip_required)
+4 −8
Original line number Diff line number Diff line
@@ -5,12 +5,8 @@ set -ev
export Python=${Python:?}
export WORKSPACE=${WORKSPACE:?}

cd build
export LD_LIBRARY_PATH=${WORKSPACE}/install/lib
export PYTHONPATH=${WORKSPACE}/install/$(python${Python} -c "from distutils.sysconfig import *; print(get_python_lib(True, prefix=''))")

PYTHON_EXECUTABLE="/usr/local/bin/python${Python}"
PYTHON_VERSION="$(${PYTHON_EXECUTABLE} -c 'import sys;print(sys.version[:3])')"
LOCAL_PYTHON_PREFIX="$(${PYTHON_EXECUTABLE} -c 'from distutils.sysconfig import *; print(get_python_lib(True, prefix=str()))')"

export PYTHONPATH=${WORKSPACE}/install/${LOCAL_PYTHON_PREFIX}
export PATH=~/Library/Python/${PYTHON_VERSION}/bin:${PATH}
../tests/run --no-network --nose nosetests-${PYTHON_VERSION}
cd ${WORKSPACE}/build
"${WORKSPACE}/tests/run"
+0 −15
Original line number Diff line number Diff line
@@ -2,8 +2,6 @@

set -ev

export Architecture=${Architecture:?}
export Distribution=${Distribution:?}
export Python=${Python:?}
export WORKSPACE=${WORKSPACE:?}

@@ -17,16 +15,6 @@ else
  PYTHON_VERSION="UNKOWN"
fi

PYTHON_VERSION_NO_DOT=$(echo $PYTHON_VERSION | sed 's|\.||')

if [ "${Distribution}" != "ubuntu/precise" -a "${Distribution}" != "debian/wheezy" ]; then
  TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)"
else
  TRIPLET=""
fi

BOOST_PYTHON_LIBRARY=/usr/lib/${TRIPLET}/libboost_python-py${PYTHON_VERSION_NO_DOT}.so

cd ${WORKSPACE}

mkdir -p build
@@ -34,10 +22,7 @@ mkdir -p install
cd build
cmake \
  -D CMAKE_INSTALL_PREFIX="${WORKSPACE}/install" \
  -D Python_ADDITIONAL_VERSIONS=${PYTHON_VERSION} \
  -D PYTHON_EXECUTABLE=/usr/bin/python${PYTHON_VERSION} \
  -D Boost_PYTHON_LIBRARY_DEBUG=${BOOST_PYTHON_LIBRARY} \
  -D Boost_PYTHON_LIBRARY_RELEASE=${BOOST_PYTHON_LIBRARY} \
  ${CMAKE_OPTIONS} \
  ..
make ${MAKE_OPTIONS} install
+14 −16
Original line number Diff line number Diff line
@@ -2,10 +2,12 @@

set -ev

export Architecture=${Architecture:?}
export Distribution=${Distribution:?}
export Python=${Python:?}
export WORKSPACE=${WORKSPACE:?}

apt-get -y update
apt-get -y --no-install-recommends install gnupg software-properties-common wget
wget -O - http://dl.bintray.com/lamyj/generic/gpg.key | apt-key add -
add-apt-repository "deb http://dl.bintray.com/lamyj/generic/apt $(lsb_release -cs) main"

if [ "${Python}" = "2" ]
then
@@ -16,21 +18,17 @@ then
fi

# Compilation toolchain
PACKAGES="build-essential cmake pkg-config python-minimal"
# WARNING: we need a full Python for tests runner (argparse may be missing from
# python-minimal)
PACKAGES="build-essential cmake pkg-config python"
# Dependencies of main lib
PACKAGES="${PACKAGES} libboost-dev libboost-date-time-dev libboost-filesystem-dev"
PACKAGES="${PACKAGES} libdcmtk2-dev libicu-dev libjsoncpp-dev liblog4cpp5-dev zlib1g-dev"
PACKAGES="${PACKAGES} libboost-dev libboost-date-time-dev "
PACKAGES="${PACKAGES} libboost-log-dev libboost-filesystem-dev"
PACKAGES="${PACKAGES} libdcmtk2-dev libicu-dev libjsoncpp-dev zlib1g-dev"
# Dependencies of Python wrappers
PACKAGES="${PACKAGES} libboost-python-dev ${PYTHON_PREFIX}-dev"
PACKAGES="${PACKAGES} pybind11-dev ${PYTHON_PREFIX}-pybind11 ${PYTHON_PREFIX}-dev"
# Dependencies of unit tests
PACKAGES="${PACKAGES} dcmtk libboost-test-dev ${PYTHON_PREFIX}-pip ${PYTHON_PREFIX}-nose"
# Coverage and static analysis
PACKAGES="${PACKAGES} cppcheck lcov wget"

if [ "${Distribution}" = "ubuntu/precise" ]
then
  PACKAGES="${PACKAGES} libwrap0-dev"
fi
PACKAGES="${PACKAGES} dcmtk libboost-test-dev ${PYTHON_PREFIX} ${PYTHON_PREFIX}-nose"

apt-get -y update
apt-get -y install ${PACKAGES}
apt-get -y --no-install-recommends install ${PACKAGES}
Loading