diff --git a/.appveyor.yml b/.appveyor.yml index 20bf88bb..d0c39078 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -28,7 +28,7 @@ install: - ps: Push-AppveyorArtifact cygcheck.log - ps: | if ($env:build_with -eq "cmake") { - $env:cfg_suffix = ".py" + $env:cfg_suffix = ".sh" $env:unittest = "unittest" $env:inttest = "inttest" } else { diff --git a/.travis.yml b/.travis.yml index c22be810..baead2e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,7 +40,7 @@ before_install: - if [[ "$BUILD_TYPE" == "asan" ]]; then export CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=address -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fPIE" MYLDFLAGS="-fsanitize=address -pie"; fi - if [[ "$BUILD_TYPE" == "tsan" ]]; then export CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=thread -O1 -fPIE" MYLDFLAGS="-fsanitize=thread -pie"; fi - if [[ "$BUILD_TYPE" == "coverage" ]]; then export CFGFLAGS="--enable-debug --disable-perl --disable-python" MYCXXFLAGS=--coverage MYLDFLAGS=--coverage DISABLED_ZNC_PERL_PYTHON_TEST=1; fi - - if [[ "$BUILD_WITH" == "cmake" ]]; then export CFGSUFFIX=.py UNITTEST=unittest INTTEST=inttest; else export CFGSUFFIX= UNITTEST=test INTTEST=test2; fi + - if [[ "$BUILD_WITH" == "cmake" ]]; then export CFGSUFFIX=.sh UNITTEST=unittest INTTEST=inttest; else export CFGSUFFIX= UNITTEST=test INTTEST=test2; fi # UBSan randomly crashes clang, and very often :( # CFGFLAGS=--enable-debug MYCXXFLAGS="-fsanitize=undefined -O1 -fPIE -fno-sanitize-recover" MYLDFLAGS="-fsanitize=undefined -pie -fno-sanitize-recover" - if [[ "$TRAVIS_REPO_SLUG" == "znc/znc" && "$TRAVIS_PULL_REQUEST" == "false" && "$TRAVIS_BRANCH" == "master" ]]; then openssl aes-256-cbc -d -in .travis-github.enc -out ~/znc-github-key -k ${SECRET_KEY}; fi diff --git a/README.md b/README.md index e335c6ac..7a216065 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Character Encodings: Currently there are 2 build systems in place: CMake and `./configure`. `./configure` will eventually be removed. -There is also `configure.py` which should make migration to CMake easier: +There is also `configure.sh` which should make migration to CMake easier: it accepts the same parameters as `./configure`, but calls CMake with CMake-style parameters. diff --git a/configure.py b/configure.sh similarity index 89% rename from configure.py rename to configure.sh index 8bc6c37c..54d28a35 100755 --- a/configure.py +++ b/configure.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/bin/sh # # Copyright (C) 2004-2016 ZNC, see the NOTICE file for details. # @@ -15,6 +15,15 @@ # limitations under the License. # +# http://stackoverflow.com/questions/18993438/shebang-env-preferred-python-version +# http://stackoverflow.com/questions/12070516/conditional-shebang-line-for-different-versions-of-python +""":" +which python3 >/dev/null 2>&1 && exec python3 "$0" "$@" +which python >/dev/null 2>&1 && exec python "$0" "$@" +which python2 >/dev/null 2>&1 && exec python2 "$0" "$@" +echo "Error: configure wrapper requires python" +exec echo "Either install python, or use cmake directly" +":""" import argparse import os diff --git a/znc-buildmod.cmake.in b/znc-buildmod.cmake.in index 3dfaeb7e..dd519f71 100755 --- a/znc-buildmod.cmake.in +++ b/znc-buildmod.cmake.in @@ -1,4 +1,4 @@ -#!/usr/bin/env python3 +#!/bin/sh # # Copyright (C) 2004-2016 ZNC, see the NOTICE file for details. # @@ -15,14 +15,35 @@ # limitations under the License. # +# http://stackoverflow.com/questions/18993438/shebang-env-preferred-python-version +# http://stackoverflow.com/questions/12070516/conditional-shebang-line-for-different-versions-of-python +""":" +which python3 >/dev/null 2>&1 && exec python3 "$0" "$@" +which python >/dev/null 2>&1 && exec python "$0" "$@" +which python2 >/dev/null 2>&1 && exec python2 "$0" "$@" +echo "Error: znc-buildmod requires python" +exec echo "Either install python, or use cmake directly" +":""" + +from __future__ import print_function import argparse import glob import os import shutil import subprocess +import sys import tempfile +if sys.version_info < (3, 0): + class TemporaryDirectory(object): + def __enter__(self): + self.name = tempfile.mkdtemp() + return self.name + def __exit__(self, *a, **k): + shutil.rmtree(self.name) + tempfile.TemporaryDirectory = TemporaryDirectory + parser = argparse.ArgumentParser( description='Build external ZNC modules and place the results to ' 'current directory. Several modules can be built at once.',