Skip to content

Commit

Permalink
Remove ./configure script.
Browse files Browse the repository at this point in the history
This patch finally fixes a long-standing gripe that I have had with my
build toolchain with the requirement to run a ./configure script. By
removing the conditional TensorFlow GPU package, I finally feel ready
to let go of this configuration script and the generated
config.pbtxt. The last remaining piece of functionality ported over
from ./configure is the recording of the workspace source path, which
has been assimilated into build_info.pbtxt.

github.com/ChrisCummins/phd/issues/73

Signed-off-by: format 2020.01.16 <github.com/ChrisCummins/format>
  • Loading branch information
ChrisCummins committed Jan 24, 2020
1 parent 3a10e66 commit 13a7967
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 19 deletions.
24 changes: 24 additions & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
#
# This script sets up the shell environment for this project.
#
# Usage:
# $ source .env

export PHD="$(realpath $(dirname "$0"))"

if [[ -f "$HOME/.cache/phd/tools/py/venv/phd/bin/activate" ]]; then
# If there is a virtualenv, use it. Note that even if it does exist, bazel
# will go ahead and ignore it, so we still need to rely on the system python
# being the required version.
. "$HOME/.cache/phd/tools/py/venv/phd/bin/activate"
fi

# Note(github.com/ChrisCummins/phd/issues/55): On macOS, custom LDFLAGS and
# CPPFLAGS are required to pip build MySQLdb:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

# Increase the timeout on docker image pulls from the default 600s.
# See: https://github.com/bazelbuild/rules_docker
export PULLER_TIMEOUT=3600
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
/node_modules

# In-tree generated files.
/.env
/bootstrap.sh
/config.pbtxt
/learn/docker/clgen/*.tar.bz2
/experimental/deeplearning/clgen/docker_worker/*.tar.bz2
/experimental/deeplearning/clgen/docker_worker/cache
Expand Down
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ env:
- TO_TEST=pypi
- TO_TEST=bazel
global:
# ./configure script symlinks python3 to ~/.local/bin/python, and macos
# image needs GNU tools in PATH, rather than BSD versions.
# MacOS image needs GNU tools in PATH, rather than BSD versions.
- PATH="$HOME/.local/bin:/usr/local/opt/coreutils/libexec/gnubin/stat:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"
# Environment variables needed for zlib.
# See: https://github.com/pyenv/pyenv/issues/530
Expand Down Expand Up @@ -53,7 +52,6 @@ install:
# Swap out GCC for GCC-5 on linux to enable support for --std=c++14.
# See: https://gist.github.com/cotsog/3ce84675af0d74438d91
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then sudo unlink /usr/bin/gcc && sudo ln -s /usr/bin/gcc-5 /usr/bin/gcc; fi
- ./configure --noninteractive
# Symlink the system python2 in place so that we bypass the pyenv shim.
- if [[ $TRAVIS_OS_NAME == "linux" ]]; then ln -s /usr/bin/python2 $HOME/.local/bin; fi

Expand Down
1 change: 0 additions & 1 deletion tools/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ sh_binary(
srcs = ["whoami.sh"],
data = [
"//:build_info_pbtxt",
"//:config",
],
)

Expand Down
4 changes: 2 additions & 2 deletions tools/source_tree/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ par_binary(
visibility = ["//visibility:public"],
deps = [
":phd_workspace",
"//:getconfig",
"//:build_info",
"//labm8/py:app",
"//labm8/py:fs",
],
Expand All @@ -55,7 +55,7 @@ par_binary(
deps = [
":phd_workspace",
":source_tree",
"//:getconfig",
"//:build_info",
"//datasets/github:api",
"//labm8/py:app",
"//labm8/py:bazelutil",
Expand Down
4 changes: 2 additions & 2 deletions tools/source_tree/deploy_pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import subprocess
import typing

import getconfig
import build_info
from labm8.py import app
from labm8.py import fs
from tools.source_tree import phd_workspace
Expand Down Expand Up @@ -121,7 +121,7 @@ def _DoDeployPip(

pypi_username, pypi_password = GetPypiCredentials()

source_path = pathlib.Path(getconfig.GetGlobalConfig().paths.repo_root)
source_path = pathlib.Path(build_info.GetBuildInfo().unsafe_workspace)
workspace = phd_workspace.PhdWorkspace(source_path)

if url is None:
Expand Down
7 changes: 1 addition & 6 deletions tools/source_tree/phd_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,13 @@
"tools/download_file.py", # Needed by //tools/bzl:maven_jar.bzl.
"tools/util.py", # Needed by //tools:download_file.py.
"third_party/*.BUILD", # Implicit dependencies of WORKSPACE file.
"tools/env.sh", # Needed by ./configure.
"tools/flaky_bazel.sh", # Needed by Travis CI.
"third_party/py/tensorflow/BUILD.in", # Needed by ./configure
"tools/workspace_status.sh", # Needed by .bazelrc
]

# A list of relative paths to files which are excluded from export. Glob
# patterns are NOT supported.
_NEVER_EXPORTED_FILES = [
"config.pbtxt", # Generated by ./configure
"third_party/py/tensorflow/BUILD", # Generated by ./configure
]
_NEVER_EXPORTED_FILES = []


class PhdWorkspace(bazelutil.Workspace):
Expand Down
1 change: 0 additions & 1 deletion tools/whoami.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env bash

cat config.pbtxt | grep -v '^#'
cat build_info.pbtxt | grep -v '^#'
5 changes: 3 additions & 2 deletions tools/workspace_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ set -eu
echo "SECONDS_SINCE_EPOCH $(date +%s)"
echo "RANDOM_HASH $(cat /dev/urandom | head -c16 | md5sum 2>/dev/null | cut -f1 -d' ')"

# Stable keys.
# Stable keys. See the BuildInfo message schema in //:config.proto for a
# description of each fields.
echo "STABLE_UNSAFE_WORKSPACE" $(pwd)
echo "STABLE_HOST $(hostname)"
echo "STABLE_USER $(id -un)"
echo "STABLE_REPO_ROOT" $(pwd)
echo "STABLE_VERSION" $(cat version.txt)

echo "STABLE_GIT_COMMIT_HASH $(git rev-parse HEAD)"
Expand Down

0 comments on commit 13a7967

Please sign in to comment.