Skip to content

Commit

Permalink
use runfiles from rules_python (#768)
Browse files Browse the repository at this point in the history
  • Loading branch information
aiuto authored Oct 28, 2023
1 parent 2b391f2 commit 1b033dd
Show file tree
Hide file tree
Showing 17 changed files with 26 additions and 28 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.bazeliskrc
.ijwb
bazel-*
MODULE.bazel.lock
2 changes: 1 addition & 1 deletion distro/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ py_test(
],
deps = [
"//pkg/releasing:release_utils",
"@bazel_tools//tools/python/runfiles",
"@rules_python//python/runfiles",
],
)

Expand Down
2 changes: 1 addition & 1 deletion distro/packaging_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import subprocess
import unittest

from bazel_tools.tools.python.runfiles import runfiles
from python.runfiles import runfiles
from pkg.releasing import release_tools
from distro import release_version

Expand Down
4 changes: 2 additions & 2 deletions tests/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ py_test(
srcs_version = "PY3",
deps = [
"//pkg/private:archive",
"@bazel_tools//tools/python/runfiles",
"@rules_python//python/runfiles",
],
)

Expand Down Expand Up @@ -208,7 +208,7 @@ py_test(
],
python_version = "PY3",
deps = [
"@bazel_tools//tools/python/runfiles",
"@rules_python//python/runfiles",
],
)

Expand Down
2 changes: 1 addition & 1 deletion tests/archive_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import unittest

from bazel_tools.tools.python.runfiles import runfiles
from python.runfiles import runfiles
from pkg.private import archive


Expand Down
2 changes: 1 addition & 1 deletion tests/deb/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ py_test(
python_version = "PY3",
deps = [
"//pkg/private:archive",
"@bazel_tools//tools/python/runfiles",
"@rules_python//python/runfiles",
],
)

Expand Down
2 changes: 1 addition & 1 deletion tests/deb/pkg_deb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import tarfile
import unittest

from bazel_tools.tools.python.runfiles import runfiles
from python.runfiles import runfiles
from pkg.private import archive


Expand Down
2 changes: 1 addition & 1 deletion tests/mappings/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ py_library(
imports = ["../.."],
srcs_version = "PY3",
deps = [
"@bazel_tools//tools/python/runfiles",
"@rules_python//python/runfiles",
],
)

Expand Down
2 changes: 1 addition & 1 deletion tests/mappings/manifest_test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import json
import unittest

from bazel_tools.tools.python.runfiles import runfiles
from python.runfiles import runfiles

class ContentManifestTest(unittest.TestCase):
"""Test harness to see if we wrote the content manifest correctly."""
Expand Down
2 changes: 1 addition & 1 deletion tests/stamp_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import unittest
import zipfile

from bazel_tools.tools.python.runfiles import runfiles
from python.runfiles import runfiles

# keep in sync with archive.py
PORTABLE_MTIME = 946684800 # 2000-01-01 00:00:00.000 UTC
Expand Down
8 changes: 4 additions & 4 deletions tests/tar/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ py_test(
srcs_version = "PY3",
deps = [
"//pkg/private/tar:tar_writer",
"@bazel_tools//tools/python/runfiles",
"@rules_python//python/runfiles",
],
)

Expand Down Expand Up @@ -208,7 +208,7 @@ pkg_tar(
name = "test-tar-strip_prefix-dot",
srcs = [
":etc/nsswitch.conf",
"@bazel_tools//tools/python/runfiles",
"@rules_python//python/runfiles",
],
strip_prefix = ".",
)
Expand Down Expand Up @@ -385,7 +385,7 @@ py_test(
python_version = "PY3",
deps = [
"//pkg/private/tar:tar_writer",
"@bazel_tools//tools/python/runfiles",
"@rules_python//python/runfiles",
],
)

Expand Down Expand Up @@ -468,7 +468,7 @@ py_test(
python_version = "PY3",
srcs_version = "PY3",
deps = [
"@bazel_tools//tools/python/runfiles",
"@rules_python//python/runfiles",
],
)

Expand Down
2 changes: 1 addition & 1 deletion tests/tar/is_compressed_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

import unittest

from bazel_tools.tools.python.runfiles import runfiles
from python.runfiles import runfiles


class IsCompressedTest(unittest.TestCase):
Expand Down
11 changes: 5 additions & 6 deletions tests/tar/pkg_tar_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import tarfile
import unittest

from bazel_tools.tools.python.runfiles import runfiles
from python.runfiles import runfiles
from pkg.private.tar import tar_writer

PORTABLE_MTIME = 946684800 # 2000-01-01 00:00:00.000 UTC
Expand Down Expand Up @@ -109,12 +109,11 @@ def test_strip_prefix_dot(self):
{'name': 'etc'},
{'name': 'etc/nsswitch.conf'},
{'name': 'external'},
{'name': 'external/bazel_tools'},
{'name': 'external/bazel_tools/tools'},
{'name': 'external/bazel_tools/tools/python'},
{'name': 'external/bazel_tools/tools/python/runfiles'},
{'name': 'external/rules_python'},
{'name': 'external/rules_python/python'},
{'name': 'external/rules_python/python/runfiles'},
# This is brittle. In old bazel the next file would be
# external/bazel_tools/tools/python/runfiles/runfiles.py, but there
# external/rules_python/python/runfiles/runfiles.py, but there
# is now _runfiles_constants.py, first. So this is too brittle.
{'halt': None},
]
Expand Down
2 changes: 1 addition & 1 deletion tests/tar/tar_writer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import tarfile
import unittest

from bazel_tools.tools.python.runfiles import runfiles
from python.runfiles import runfiles
from pkg.private.tar import tar_writer
from tests.tar import compressor

Expand Down
2 changes: 1 addition & 1 deletion tests/zip/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ py_library(
imports = ["../.."],
srcs_version = "PY3",
deps = [
"@bazel_tools//tools/python/runfiles",
"@rules_python//python/runfiles",
],
)

Expand Down
2 changes: 1 addition & 1 deletion tests/zip/zip_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import unittest
import zipfile

from bazel_tools.tools.python.runfiles import runfiles
from python.runfiles import runfiles
from tests.zip import zip_test_lib

HELLO_CRC = 2069210904
Expand Down
6 changes: 2 additions & 4 deletions tests/zip/zip_test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import unittest
import zipfile

from bazel_tools.tools.python.runfiles import runfiles
from python.runfiles import runfiles


# Unix dir bit and Windows dir bit. Magic from zip spec
Expand All @@ -44,9 +44,7 @@ def setUp(self):
def get_test_zip(self, zip_file):
"""Get the file path to a generated zip in the runfiles."""

return self.data_files.Rlocation(
"rules_pkg/tests/zip/" + zip_file
)
return self.data_files.Rlocation("rules_pkg/tests/zip/" + zip_file)


class ZipContentsTestBase(ZipTest):
Expand Down

0 comments on commit 1b033dd

Please sign in to comment.