diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ad673db --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,42 @@ +name: Build Python + +on: + push: + branches: + - '*' + +jobs: + build: + runs-on: macos-latest + steps: + - uses: actions/checkout@v1 + # OS info + - run: uname -a && sw_vers + # We need to ensure openSSL is available + - run: HOMEBREW_NO_AUTO_UPDATE=1 brew install openssl + - run: brew list --versions openssl + - run: OPEN_SSL_DIR=$(brew --prefix openssl) && echo $OPEN_SSL_DIR + #- run: "$OPEN_SSL_DIR/bin/openssl" version + # Download, build Python, and upload it + - run: sh build_python.sh + - run: mkdir upload + - run: tar czf upload/python3-full.tar.gz python/ + - uses: actions/upload-artifact@v1 + with: + name: python3-full + path: ./upload/python3-full.tar.gz + # Check built Python + - run: du -sk python/ + - run: cp ./python/bin/python3.7 ./python/bin/python3 + - run: otool -L python/bin/python3 + - run: ./python/bin/python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)' + - run: otool -L python/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so + - run: ./python/bin/python3 -m pip --version + # Reduce built Python and upload it + - run: python process_python_build.py python/ + - run: echo "Python 3.7.5" >> python/version.txt + - run: tar czf upload/python3-reduced.tar.gz python/ + - uses: actions/upload-artifact@v1 + with: + name: python3-reduced + path: ./upload/python3-reduced.tar.gz diff --git a/.gitignore b/.gitignore index 1377554..fbd0933 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,14 @@ *.swp +python/* +Python-3*/* + +# OS X +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 675d217..0000000 --- a/.travis.yml +++ /dev/null @@ -1,49 +0,0 @@ -# Travis can building for Linux and macOS -matrix: - include: - # To maximise compatibility pick earliest image, OS X 10.10 Yosemite - - os: osx - osx_image: xcode6.4 - sudo: required - language: generic - -before_install: - # OS and default Python info - - uname -a - - if [ "$TRAVIS_OS_NAME" = "osx" ]; then sw_vers; fi - -install: - - HOMEBREW_NO_AUTO_UPDATE=1 brew install openssl - - PROJECT_DIR="$PWD" - - echo $PROJECT_DIR - - mkdir upload - -script: - # Download and build Python - - cd "$PROJECT_DIR" - - sh build_python.sh - - # Compress and upload it before touching it - - cd "$PROJECT_DIR" - - tar czf upload/python3-full.tar.gz python/ - - curl --upload-file ./upload/python3-full.tar.gz https://transfer.sh/python3-full.tar.gz | tee -a output_urls.txt && echo "" >> output_urls.txt - - # Check built Python - - cd "$PROJECT_DIR" - - du -sk python/ - - cd python - - otool -L bin/python3.6 - - cp ./bin/python3.6 ./bin/python3 - - ./bin/python3 -c 'import ssl; print(ssl.OPENSSL_VERSION)' - - ./bin/python3 -m pip --version - - # Reduce stand-alone Python and upload it - - cd "$PROJECT_DIR" - - python process_python_build.py "$PROJECT_DIR/python" - - echo "Python 3.6.5" >> ./python/version.txt - - tar czf upload/python3-reduced.tar.gz python/ - - curl --upload-file ./upload/python3-reduced.tar.gz https://transfer.sh/python3-reduced.tar.gz | tee -a output_urls.txt && echo "" >> output_urls.txt - - # Print all uploaded files URLs - - cd "$PROJECT_DIR" - - cat output_urls.txt diff --git a/build_python.sh b/build_python.sh old mode 100644 new mode 100755 index 1f14d67..5166267 --- a/build_python.sh +++ b/build_python.sh @@ -1,7 +1,10 @@ #!/bin/sh +set -e alias large_echo='{ set +x; } 2> /dev/null; f(){ echo "#\n#\n# $1\n#\n#"; set -x; }; f' +PY_VER=3.7.5 + large_echo "Check OpenSSL installation path and CWD" if brew ls --versions openssl > /dev/null; then OPENSSL_ROOT="$(brew --prefix openssl)" @@ -13,12 +16,12 @@ fi CURRENT_DIR="$PWD" echo $CURRENT_DIR -large_echo "Download and uncompress Python source" -wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tgz -tar -zxvf Python-3.6.5.tgz &> /dev/null +large_echo "Download and uncompress Python $PY_VER source" +wget "https://www.python.org/ftp/python/$PY_VER/Python-$PY_VER.tgz" +tar -zxvf "Python-$PY_VER.tgz" &> /dev/null -cd Python-3.6.5 +cd "Python-$PY_VER" large_echo "Configure Python" -./configure MACOSX_DEPLOYMENT_TARGET=10.9 CPPFLAGS="-I$OPENSSL_ROOT/include" LDFLAGS="-L$OPENSSL_ROOT/lib" --prefix="$CURRENT_DIR/python" +./configure MACOSX_DEPLOYMENT_TARGET=10.11 CPPFLAGS="-I$OPENSSL_ROOT/include" LDFLAGS="-L$OPENSSL_ROOT/lib" --with-openssl="$OPENSSL_ROOT" --prefix="$CURRENT_DIR/python" large_echo "Build Python" make altinstall diff --git a/process_python_build.py b/process_python_build.py index 1e317fa..31d2a35 100644 --- a/process_python_build.py +++ b/process_python_build.py @@ -13,7 +13,7 @@ VERBOSE = False # Python version is used for folder names and exec files in built output -VERSION_STR = '3.6' +VERSION_STR = '3.7' PYTHON_VER = 'python{}'.format(VERSION_STR) # Set the files and directories we can remove from a Python build folder