Commit a38a567e authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Add edit_requirements_txt_for_downstream_in_subdir

parent 0cd73482
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -621,6 +621,7 @@ function build_and_run_benchmarks

# }}}


# {{{ transfer_requirements_git_urls

function transfer_requirements_git_urls()
@@ -631,4 +632,24 @@ function transfer_requirements_git_urls()

# }}}


# {{{ edit_requirements_txt_for_downstream_in_subdir

function edit_requirements_txt_for_downstream_in_subdir()
{
  # Assumed to be run in directory of downstream project checked out in
  # subdirectory of upstream.

  # Unshallow the upstream repo. Without that, a bunch of the commands that
  # pip (as of 21.3) uses cause copious error spew, along the lines of
  # "warning: rejected (SHA) because shallow roots are not allowed to be updated"
  # "warning: filtering not recognized by server, ignoring"
  (cd ..; git fetch --unshallow)

  PRJ_NAME="$(basename "$GITHUB_REPOSITORY")"
  sed -i "/egg=$PRJ_NAME/ c git+file://$(readlink -f ..)#egg=$PRJ_NAME" requirements.txt
}

# }}}

# vim: foldmethod=marker:sw=2