Deploying tarballs

This commit is contained in:
Thomas Ferreira de Lima 2018-07-11 19:43:07 -04:00
parent 293fb905c1
commit a834fd281d
No known key found for this signature in database
GPG Key ID: 43E98870EAA0A86E
4 changed files with 48 additions and 127 deletions

View File

@ -4,17 +4,40 @@ matrix:
osx_image: xcode9.3beta
env:
- MATRIX_EVAL=""
before_install:
- eval "${MATRIX_EVAL}"
- brew update
- brew bundle
- eval "${MATRIX_EVAL}"
- brew update
- brew bundle
- env
install:
- rvm install ruby --latest
- gem install dropbox-deployment
- git clone https://github.com/kristovatlas/osx-config-check
- cd osx-config-check ; python2.7 app.py --report-only --skip-sudo-checks ; cd ..
script:
- python3 build4mac.py -p B37 -q Qt5Brew -c
- source filter-clang.sh; python3 build4mac.py -p B37 -q Qt5Brew | filter
- python3 build4mac.py -p B37 -q Qt5Brew -y
- python3 build4mac.py -p B37 -q Qt5Brew -c
- source filter-clang.sh; python3 build4mac.py -p B37 -q Qt5Brew | filter
- python3 build4mac.py -p B37 -q Qt5Brew -y
- qt5.pkg.macos-HighSierra-release/klayout.app/Contents/MacOS/klayout -b -r test-pylib-script.py
- cd qt5.build.macos-HighSierra-release
- ln -s klayout.app/Contents/MacOS/klayout klayout
- export TESTTMP=testtmp # path to a directory that will hold temporary data (will be created)
- export TESTSRC=.. # path to the source directory
- ./ut_runner -h
- ./ut_runner -s || true
- cd ..
- export gitcommit=$(git rev-parse --short HEAD)
- mkdir deploy
- tar czf "deploy/qt5.pkg.macos-HighSierra-release-$gitcommit.tar.gz" qt5.pkg.macos-HighSierra-release
after_success:
- dropbox-deployment
deploy:
provider: s3
- provider: s3
access_key_id: AKIAIV2JJIENURARWFUQ
secret_access_key:
secure: LdxO80/boYFIa/6XuF1gi2V7vtoDFro+ImIcmf8ARKddYxjlLp31mVDt1ZezeYvjPt3T0KvDErMtez7Ea8yUPXayxLycAb5nEhP6QMTuW3QcSTllsG3Bpz1b1zCx4LiYWzYbmgqHru1kh3WhqQbKAgq4Xl5zIIE2yvWlGvpUf9mP586KGe5HJl6hbAJI8XdkJTjp48jHanKIUlxDDPrxon1i1GD+8PSl2JEvggRpp+mSaA5dJJJRYPNFlQn0T1TuHkRBErLqHYJ8qTSee72jMbTOVOPxuMy4KKdZt6bpDJiJccH2FJ87+qyXM/8dDQnlpWPVOgQhklFBMUmGkooVxfjphVLmBRNgkfohBC6DmKeIk/Os+TRvXjuL/SMwQ17jwKSRw/QPrIGwvGb2GdZ/jQCV0WWw3x/N8xlXZ2EhkLC8lznVuaf++CCC3qm0+ejojRFz7uFyqDvq9HPXHzllZTbTMI+6+QE5Gpi1s513iio/nRPYCLoyFe5144VfnlJCXxsC11jrous2HWo2YFJGqj0ipJdnit/Kolq+Shs2gTiGz0yb7f/JKsyA/N0Bz4npKlt7O1MmXyFjDJCfSn2WyfXjSYiyKu3fjkbf4e4AK5qsR2BcNlJXl6Z3ACLIS6OinRPFLZyCS24yQ0eNIR1Q5Xvg88vTUbyhDc2QsYpyP1Y=
@ -23,4 +46,5 @@ deploy:
skip_cleanup: true
on:
repo: dwang/klayout
branch: travis-ci
branch: travis-ci-pr

4
dropbox-deployment.yml Normal file
View File

@ -0,0 +1,4 @@
deploy:
dropbox_path: /Builds/klayout # The path to the folder on Dropbox where the files will go
artifacts_path: deploy # can be a single file, or a path
debug: true # if you want to see more logs

View File

@ -1,98 +0,0 @@
import os, subprocess
import sys
from macbuild.build4mac_util import WalkFrameworkPaths, PerformChanges, DetectChanges
from pathlib import Path
# bundlePath = AbsMacPkgDir
bundlePath = os.getcwd() + '/qt5.pkg.macos-HighSierra-release/klayout.app'
bundleExecPathAbs = '%s/Contents/MacOS/' % bundlePath
pythonOriginalFrameworkPath = '/usr/local/opt/python/Frameworks/Python.framework'
pythonFrameworkPath = '%s/Contents/Frameworks/Python.framework' % bundlePath
print("[1] Copying Python Framework")
shell_commands = list()
shell_commands.append(f"rm -rf {pythonFrameworkPath}")
shell_commands.append(f"rsync -a --safe-links {pythonOriginalFrameworkPath}/ {pythonFrameworkPath}")
shell_commands.append(f"mkdir {pythonFrameworkPath}/Versions/3.6/lib/python3.6/site-packages/")
shell_commands.append(f"cp -RL {pythonOriginalFrameworkPath}/Versions/3.6/lib/python3.6/site-packages/{{pip*,pkg_resources,setuptools*,wheel*}} " +
f"{pythonFrameworkPath}/Versions/3.6/lib/python3.6/site-packages/")
shell_commands.append(f"rm -rf {pythonFrameworkPath}/Versions/3.6/lib/python3.6/test")
shell_commands.append(f"rm -rf {pythonFrameworkPath}/Versions/3.6/Resources")
shell_commands.append(f"rm -rf {pythonFrameworkPath}/Versions/3.6/bin")
for command in shell_commands:
if subprocess.call( command, shell=True ) != 0:
msg = "command failed: %s"
print( msg % command, file=sys.stderr )
exit(1)
print("[2] Relinking dylib dependencies inside Python.framework")
depdict = WalkFrameworkPaths(pythonFrameworkPath)
appPythonFrameworkPath = '@executable_path/../Frameworks/Python.framework/'
PerformChanges(depdict, [(pythonOriginalFrameworkPath, appPythonFrameworkPath)], bundleExecPathAbs)
usrLocalPath = '/usr/local/opt/'
appUsrLocalPath = '@executable_path/../Frameworks/'
depdict = WalkFrameworkPaths(pythonFrameworkPath)
PerformChanges(depdict, [(usrLocalPath, appUsrLocalPath)], bundleExecPathAbs, libdir=True)
print("[3] Relinking dylib dependencies for klayout")
klayoutPath = bundleExecPathAbs
depdict = WalkFrameworkPaths(klayoutPath, filter_regex=r'klayout$')
PerformChanges(depdict, [(pythonOriginalFrameworkPath, appPythonFrameworkPath)], bundleExecPathAbs)
libKlayoutPath = bundleExecPathAbs + '../Frameworks'
depdict = WalkFrameworkPaths(libKlayoutPath, filter_regex=r'libklayout')
PerformChanges(depdict, [(pythonOriginalFrameworkPath, appPythonFrameworkPath)], bundleExecPathAbs)
print("[4] Patching site.py, pip/, and distutils/")
site_module = f"{pythonFrameworkPath}/Versions/3.6/lib/python3.6/site.py"
with open(site_module, 'r') as site:
buf = site.readlines()
with open(site_module, 'w') as site:
import re
for line in buf:
# This will fool pip into thinking it's inside a virtual environment
# and install new packates to the correct site-packages
if re.match("^PREFIXES", line) is not None:
line = line + "sys.real_prefix = sys.prefix\n"
# do not allow installation in the user folder.
if re.match("^ENABLE_USER_SITE", line) is not None:
line = "ENABLE_USER_SITE = False\n"
site.write(line)
pip_module = f"{pythonFrameworkPath}/Versions/3.6/lib/python3.6/site-packages/pip/__init__.py"
with open(pip_module, 'r') as pip:
buf = pip.readlines()
with open(pip_module, 'w') as pip:
import re
for line in buf:
# this will reject user's configuration of pip, forcing the isolated mode
line = re.sub("return isolated$", "return isolated or True", line)
pip.write(line)
distutilsconfig = f"{pythonFrameworkPath}/Versions/3.6/lib/python3.6/distutils/distutils.cfg"
with open(distutilsconfig, 'r') as file:
buf = file.readlines()
with open(distutilsconfig, 'w') as file:
import re
for line in buf:
# This will cause all packages to be installed to sys.prefix
if re.match('prefix=', line) is not None:
continue
file.write(line)
# pythonPath = bundleExecPathAbs + '../Frameworks/Python.framework/Versions/3.6/bin/'
# # pythonOriginalPrefixPath = '/usr/local/opt/python/Frameworks/Python.framework/Versions/3.6'
# # appPythonBinPath = '@executable_path/../'
# depdict = WalkFrameworkPaths(pythonPath, filter_regex=r'python')
# print(depdict)
# PerformChanges(depdict, [(pythonOriginalFrameworkPath, appPythonFrameworkPath),
# (Path(pythonOriginalFrameworkPath).resolve(), appPythonFrameworkPath)], bundleExecPathAbs)
# usrLocalPath = '/usr/local/lib/'
# appUsrLocalPath = '@executable_path/../Frameworks/'
# depdict = WalkFrameworkPaths(pythonFrameworkPath)
# PerformChanges(depdict, [(usrLocalPath, appUsrLocalPath)], bundleExecPathAbs)

View File

@ -1,11 +1,5 @@
import site; print(site.getsitepackages())
import pip
installed_packages = pip.get_installed_distributions()
installed_packages_list = sorted(["%s==%s" % (i.key, i.version)
for i in installed_packages])
print(installed_packages_list)
def get_pip_main():
import pip
# check if pip version is new:
@ -15,20 +9,6 @@ def get_pip_main():
from pip import main
return main
print("-------------")
pipmain = get_pip_main()
if pipmain(['install', '--upgrade', 'numpy']) > 0:
exit(1)
print("-------------")
print("Importing numpy")
import numpy
print("-------------")
import sys
print("Executing from: ", sys.executable)
print("-------------")
@ -37,3 +17,14 @@ import os
print("Environment variables:")
for variable, value in os.environ.items():
print(variable, ":", value)
pipmain = get_pip_main()
print("-------------")
if pipmain(['install', '--upgrade', 'numpy']) > 0:
exit(1)
print("-------------")
print("Importing numpy")
import numpy
print("-------------")