Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix building of rubygems #1341

Merged
merged 3 commits into from
Jun 22, 2018
Merged
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
6 changes: 4 additions & 2 deletions tooling/scripts/ensure-rustup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ if ! which rustup > /dev/null ; then
curl https://sh.rustup.rs -sSf | sh -s -- -y
fi

if ! rustup show | grep nightly > /dev/null ; then
rustup install nightly
if ! rustup show | grep stable > /dev/null ; then
rustup install stable
fi

rustup default stable

rustup update
11 changes: 9 additions & 2 deletions tooling/src/hypothesistooling/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,16 @@ def check_ruby_tests():
)
sys.exit(1)

task_to_run = os.environ.get('TASK')
if task_to_run is None:
if len(sys.argv) > 1:
task_to_run = sys.argv[1]
else:
task_to_run = os.environ.get('TASK')

if task_to_run is None:
print(
'No task specified. Either pass the task to run as an '
'argument or as an environment variable TASK.')
sys.exit(1)

if task_to_run == 'python':
os.execv(sys.executable, [sys.executable] + sys.argv[2:])
Expand Down
7 changes: 7 additions & 0 deletions tooling/src/hypothesistooling/junkdrawer.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,10 @@ def accept():
accept.has_been_called = False
accept.__name__ = fn.__name__
return accept


def unlink_if_present(path):
try:
os.unlink(path)
except FileNotFoundError:
pass
4 changes: 2 additions & 2 deletions tooling/src/hypothesistooling/projects/hypothesisruby.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import hypothesistooling.installers as install
import hypothesistooling.releasemanagement as rm
from hypothesistooling import git
from hypothesistooling.junkdrawer import once, in_dir
from hypothesistooling.junkdrawer import once, in_dir, unlink_if_present

PACKAGE_NAME = 'hypothesis-ruby'

Expand Down Expand Up @@ -141,7 +141,7 @@ def upload_distribution():

# Yes, rubygems really will only look in this file. Yes this is terrible.
# This only runs on Travis, so we may be assumed to own it, but still.
os.path.unlink(RUBYGEMS_CREDENTIALS)
unlink_if_present(RUBYGEMS_CREDENTIALS)

# symlink so that the actual secret credentials can't be leaked via the
# cache.
Expand Down