Skip to content

Commit

Permalink
Rename //rules_python package to //packaging (bazelbuild#228)
Browse files Browse the repository at this point in the history
This avoids a name clash between the package name and the repo name, which
prevented whl_test from running in the Bazel federation's CI.

Regenerated the par files.

Tested that this still works in environments where the system Python has a
library named "packaging" installed, by creating a virtualenv, pip installing
"packaging", and running `bazel test //examples/...`.

Fixes bazelbuild#227.
  • Loading branch information
brandjon authored Aug 14, 2019
1 parent a48a8c8 commit 9d68f24
Show file tree
Hide file tree
Showing 9 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ all_targets: &all_targets
build_targets:
- "//examples/..."
- "//experimental/..."
- "//packaging/..."
- "//python/..."
- "//rules_python/..."
- "//tools/..."
test_targets:
- "..."
Expand Down
1 change: 0 additions & 1 deletion rules_python/BUILD → packaging/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
package(default_visibility = ["//visibility:public"])

licenses(["notice"]) # Apache 2.0

Expand Down
2 changes: 1 addition & 1 deletion rules_python/piptool.py → packaging/piptool.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def pip_main(argv):
argv = ["--disable-pip-version-check", "--cert", cert_path] + argv
return pip.main(argv)

from rules_python.whl import Wheel
from packaging.whl import Wheel

parser = argparse.ArgumentParser(
description='Import Python dependencies into Bazel.')
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion rules_python/whl_test.py → packaging/whl_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

from mock import patch

from rules_python import whl
from packaging import whl


def TestData(name):
Expand Down
Binary file modified tools/piptool.par
Binary file not shown.
4 changes: 2 additions & 2 deletions tools/update_tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ RUN bazel help info >/dev/null 2>&1
CMD cp -r /opt/rules_python_source /opt/rules_python && \
cd /opt/rules_python && \
bazel clean && \
bazel build //rules_python:piptool.par //rules_python:whltool.par \
bazel build //packaging:piptool.par //packaging:whltool.par \
# This works around a bug in git_repository to give us better debugging
# if there's an error.
# TODO(brandjon): Remove this once we're using Bazel 0.29, which
# contains the fix.
--incompatible_string_join_requires_strings=false && \
cp bazel-bin/rules_python/piptool.par bazel-bin/rules_python/whltool.par /opt/rules_python_source/tools/ && \
cp bazel-bin/packaging/piptool.par bazel-bin/packaging/whltool.par /opt/rules_python_source/tools/ && \
chown --reference=/opt/rules_python_source/update_tools.sh /opt/rules_python_source/tools/piptool.par /opt/rules_python_source/tools/whltool.par
Binary file modified tools/whltool.par
Binary file not shown.
6 changes: 3 additions & 3 deletions update_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ if [ "$#" -eq 0 ] ; then
docker build --no-cache -f tools/update_tools/Dockerfile --tag rules_python:update_tools .
docker run -v"$PWD":/opt/rules_python_source rules_python:update_tools
elif [ "$#" -eq 1 -a "$1" == "--nodocker" ] ; then
bazel build //rules_python:piptool.par //rules_python:whltool.par
cp bazel-bin/rules_python/piptool.par tools/piptool.par
cp bazel-bin/rules_python/whltool.par tools/whltool.par
bazel build //packaging:piptool.par //packaging:whltool.par
cp bazel-bin/packaging/piptool.par tools/piptool.par
cp bazel-bin/packaging/whltool.par tools/whltool.par
else
usage
fi

0 comments on commit 9d68f24

Please sign in to comment.