Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
FROM ubuntu:16.04 AS trusty-ci
FROM python:3.7

WORKDIR /elle

COPY drake/requirements.txt .

RUN apt-get update && apt-get install -y ccache fuse git python3.5 python3-pip valgrind && rm -rf /var/lib/apt/lists/*
ADD drake/requirements.txt .
RUN pip3 install -r requirements.txt

COPY . .

# since Drake writes all its temp files right into the build dir,
# we have to have it on the .dockerignore file
# but at the same time we also want build scripts in the image, so...
RUN git checkout _build
# (yes, this is a bit shitty, maybe we want to have drake use a working
# dir well separated from anything checked in - this would also allow
# first building the base image with just the dependencies compiled, then
# compiling elle itself, thus using the build cache much more
# efficiently)

# always nice to have drake tell us what it's doing
ENV DRAKE_DEBUG=1
ENV DRAKE_DEBUG_BACKTRACE=1
ENV DRAKE_RAW=1

RUN cd _build/linux64 && ./drake //build
25 changes: 25 additions & 0 deletions _build/_common/venv_wrapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# Should arguably be made part of drake itself?

set -e

ARCH_DIR="$(readlink -f "$(dirname $0)")"

if [[ "$ELLE_BUILD_USE_VENV" ]]; then
VENV_DIR="$ARCH_DIR/venv"
[ -d "$VENV_DIR" ] || python3 -m venv "$VENV_DIR"

. "$VENV_DIR/bin/activate"

REPO_ROOT=$(git rev-parse --show-toplevel)
REQS_FILE="$REPO_ROOT/drake/requirements.txt"
LAST_INSTALL_SENTINEL="$ARCH_DIR/last_venv_install"

if [[ "$REQS_FILE" -nt "$LAST_INSTALL_SENTINEL" ]]; then
pip install -r "$REQS_FILE"
touch "$LAST_INSTALL_SENTINEL"
fi
fi

exec "$ARCH_DIR/run" "$@"
45 changes: 0 additions & 45 deletions _build/ios/drake

This file was deleted.

1 change: 1 addition & 0 deletions _build/ios/drake
45 changes: 45 additions & 0 deletions _build/ios/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env python3

import os
import sys
root = os.path.dirname(__file__)
drake = os.path.abspath(os.path.join(root, '../../drake/src'))
sys.path.insert(0, drake)

import resource
resource.setrlimit(resource.RLIMIT_NOFILE, (500, -1))

import drake
import drake.cxx
import drake.cxx.boost

# Must set environment variables before setting up toolkit.
# /Applications/Xcode6-Beta6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.0.sdk
os.environ['CROSS_TOP'] = '/Applications/Xcode6-Beta6.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer'
os.environ['CROSS_SDK'] = 'iPhoneOS8.0.sdk'
os.environ['SDKROOT'] = '%s/SDKs/%s' % (os.environ['CROSS_TOP'], os.environ['CROSS_SDK'])
os.environ['TOOLCHAINS'] = ''
os.environ['DEVELOPER_DIR'] = '/Applications/Xcode6-Beta6.app/Contents/Developer'
os.environ['IOS_DEPLOYMENT_TARGET'] = '7.0'

with drake.Drake('../..') as d:
cxx_compiler = os.getenv('CXX', 'clang++')
c_compiler = os.getenv('CC', 'clang')
cxx_toolkit = drake.cxx.GccToolkit(compiler = cxx_compiler,
compiler_c = c_compiler)

cxx_config = drake.cxx.Config()
cxx_config.enable_debug_symbols()
cxx_config.enable_optimization(False)
cxx_config.flag('-arch')
cxx_config.flag('armv7')
cxx_config.flag('-ftemplate-depth=512')
cxx_config.flag('-std=c++11')
cxx_config.flag('-stdlib=libc++')
cxx_config.flag('-miphoneos-version-min=7.0')
cxx_config.flag('--sysroot=%s' % os.environ['SDKROOT'])
cxx_config.warnings.overloaded_virtual = False

d.run(cxx_toolkit,
cxx_config,
python3 = None)
13 changes: 0 additions & 13 deletions _build/linux32/drake

This file was deleted.

1 change: 1 addition & 0 deletions _build/linux32/drake
13 changes: 13 additions & 0 deletions _build/linux32/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env python3

import os, sys
sys.path.insert(
0,
os.path.abspath(
os.path.join(os.path.dirname(__file__), '../../drake/src')
)
)

import drake

drake.run('../..')
24 changes: 0 additions & 24 deletions _build/linux64/drake

This file was deleted.

1 change: 1 addition & 0 deletions _build/linux64/drake
24 changes: 24 additions & 0 deletions _build/linux64/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env python3

import os, sys
sys.path.insert(
0,
os.path.abspath(
os.path.join(os.path.dirname(__file__), '../../drake/src')
)
)

import drake
import drake.cxx
import drake.valgrind

try:
valgrind = drake.valgrind.Valgrind()
except:
valgrind = None

cfg = drake.cxx.Config()
cfg.enable_debug_symbols()

with drake.Drake('../..') as d:
d.run(cxx_config = cfg, valgrind = valgrind)
50 changes: 0 additions & 50 deletions _build/macosx64/drake

This file was deleted.

1 change: 1 addition & 0 deletions _build/macosx64/drake
15 changes: 8 additions & 7 deletions drake/src/drake/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3627,8 +3627,8 @@ def __search(self, what, where, all):
return rel
if len(res) > 0:
return res
raise Exception('Unable to find %s in %s.' % \
(what, pretty_listing(where)))
raise RuntimeError('Unable to find %s in %s.' % \
(what, pretty_listing(where)))

def _search_all(self, what, where):
return self.__search(what, where, all = True)
Expand All @@ -3646,8 +3646,8 @@ def _search_many(self, whats, where, all, prefer):
except Exception:
pass
if len(res) == 0:
raise Exception('Unable to find %s in %s.' % \
(pretty_listing(whats), pretty_listing(where)))
raise RuntimeError('Unable to find %s in %s.' % \
(pretty_listing(whats), pretty_listing(where)))
if not all:
assert prefer is not None
for prefix, what in res:
Expand Down Expand Up @@ -3797,9 +3797,9 @@ def __init__(self, major = None, minor = None, subminor = None):
elif isinstance(major, str) and \
minor is None and subminor is None:
try:
self.__init__(*(int(c) for c in major.split('.')))
except Exception as e:
raise Exception('invalid version: %r', major) from e
self.__init__(*(int(c) for c in major.split('.', 3)))
except ValueError as e:
raise RuntimeError('invalid version: %r' % major) from e
else:
assert major is not None or minor is None and subminor is None
assert minor is not None or subminor is None
Expand Down Expand Up @@ -4212,6 +4212,7 @@ def job():
return False
if self.__fingerprint is not None:
import hashlib
# FIXME: we should get a more secure hashing algo here
d = hashlib.md5()
d.update(content)
h = d.hexdigest()
Expand Down
15 changes: 9 additions & 6 deletions drake/src/drake/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
#
# See the LICENSE file for more information.

import drake
import subprocess

import drake


def _find_command(t, v):
if v is False:
return None
Expand All @@ -23,6 +25,7 @@ def _find_command(t, v):
else:
return t(v)


class Command:

__drake_configure__ = _find_command
Expand All @@ -38,13 +41,13 @@ def __init__(self, path = None):
self.__path = drake.Path(path)
try:
output = self._get_version()
except Exception as e:
raise Exception('Unable to find %s' % self.path) from e
except RuntimeError as e:
raise RuntimeError('Unable to find %s' % self.path) from e
try:
self.__version = self._parse_version(output)
except Exception as e:
raise Exception('Unable to parse %s version from %r' % \
(self.__class.name, output)) from e
except RuntimeError as e:
raise RuntimeError('Unable to parse %s version from %r: %s' % \
(self.__class__.name, output, e)) from e

def _get_version(self):
return subprocess.check_output(
Expand Down
4 changes: 3 additions & 1 deletion drake/src/drake/cxx/boost.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ class Boost(drake.Configuration):
'coroutine': 'coroutine',
'iostreams': 'iostreams',
'python': list(itertools.chain(
*(('python3{}'.format(v), 'python-3.{}'.format(v)) for v in range(7)))) \
# FIXME: define in a central place what currently is the maximum
# version of python3 that we support... (that's 7 + 1, below)
*(('python3{}'.format(v), 'python-3.{}'.format(v)) for v in range(8)))) \
+ ['python3', 'python']
}

Expand Down
Loading