source: trunk/misc/build_helpers/build-osx-pkg.sh

Last change on this file was 922554c, checked in by Jean-Paul Calderone <exarkun@…>, at 2019-01-26T15:02:08Z

Probably some test cruft screws up the package

  • Property mode set to 100755
File size: 2.2 KB
Line 
1#!/bin/sh
2
3VERSION=`sh -c "cat src/allmydata/_version.py | grep verstr | head -n 1 | cut -d' ' -f 3" | sed "s/\"//g"`
4PWD=`pwd`
5TARGET="/Applications/tahoe.app"
6
7# Clean up any test garbage that might be left over from a recent test run.
8rm -rvf _trial_temp
9
10virtualenv osx-venv
11osx-venv/bin/pip install .
12
13# The virtualenv contains all the dependencies we need, but the bin/python
14# itself is not useful, nor is having it as the shbang line in the generated
15# bin/tahoe executable. Replace bin/tahoe with a form that explicitly sets
16# sys.path to the target directory (/Applications/tahoe.app). This isn't as
17# isolated as a proper virtualenv would be (the system site-packages
18# directory will still appear later in sys.path), but I think it ought to
19# work.
20
21rm osx-venv/bin/*
22cat >osx-venv/bin/tahoe <<EOF
23#!/usr/bin/env python
24import sys, os.path
25up = os.path.dirname
26bintahoe = os.path.abspath(__file__)
27appdir = up(up(bintahoe))
28sitedir = os.path.join(appdir, "lib", "python2.7", "site-packages")
29# usually "/Applications/tahoe.app/lib/python2.7/site-packages"
30sys.path.insert(0, sitedir)
31from allmydata.scripts.runner import run
32run()
33EOF
34chmod +x osx-venv/bin/tahoe
35
36# The venv has a .pth file which allows "import zope.interface" to work even
37# though "zope" isn't really a package (it has no __init__.py). The venv's
38# python has this site-packages/ on sys.path early enough to process the .pth
39# file, and running tahoe with PYTHONPATH=...site-packages would also process
40# it, but a simple sys.path.insert doesn't. This is the simplest hack I could
41# find to fix it.
42
43touch osx-venv/lib/python2.7/site-packages/zope/__init__.py
44
45cp -r $PWD/misc/build_helpers/osx/Contents osx-venv/Contents
46
47# create component pkg
48pkgbuild --root osx-venv \
49         --identifier com.leastauthority.tahoe \
50         --version "$VERSION" \
51         --ownership recommended \
52         --install-location $TARGET \
53         --scripts "$PWD/misc/build_helpers/osx/scripts" \
54         tahoe-lafs.pkg
55
56# create product archive
57productbuild --distribution "$PWD/misc/build_helpers/osx/Distribution.xml" \
58             --package-path . \
59             "tahoe-lafs-$VERSION-osx.pkg"
60
61# remove intermediate pkg
62rm -f tahoe-lafs.pkg
Note: See TracBrowser for help on using the repository browser.