Skip to content

Commit 6842fe4

Browse files
committed
Fix the build and test suite for macOS #1703
Signed-off-by: tdruez <tdruez@nexb.com>
1 parent 61b7940 commit 6842fe4

3 files changed

Lines changed: 9 additions & 12 deletions

File tree

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ v35.1.0 (unreleased)
1616
license rules used during the scan.
1717
https://github.com/aboutcode-org/scancode.io/issues/1657
1818

19-
- Add a new step to the ``DeployToDevelop`` pipeline, ``match_python``, to match
19+
- Add a new step to the ``DeployToDevelop`` pipeline, ``map_python``, to match
2020
Cython source files (.pyx) to their compiled binaries.
2121
https://github.com/aboutcode-org/scancode.io/pull/1703
2222

scanpipe/pipes/d2d.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
from go_inspector.plugin import collect_and_parse_symbols
4848
from packagedcode.npm import NpmPackageJsonHandler
4949
from rust_inspector.binary import collect_and_parse_rust_symbols
50-
from source_inspector.symbols_tree_sitter import get_tree_and_language_info
5150
from summarycode.classify import LEGAL_STARTS_ENDS
5251

5352
from aboutcode.pipeline import LoopProgress
@@ -2259,6 +2258,8 @@ def _map_javascript_strings(to_resource, javascript_from_resources, logger):
22592258

22602259
def map_python_pyx_to_binaries(project, logger=None):
22612260
"""Map Cython source to their compiled binaries in ``project``."""
2261+
from source_inspector.symbols_tree_sitter import get_tree_and_language_info
2262+
22622263
python_config = d2d_config.get_ecosystem_config(ecosystem="Python")
22632264
from_resources = (
22642265
project.codebaseresources.files()
@@ -2278,7 +2279,7 @@ def map_python_pyx_to_binaries(project, logger=None):
22782279
logger(f"Error parsing binary symbols at: {resource.location_path!r} {e!r}")
22792280

22802281
for resource in from_resources:
2281-
# open Cython source file, create AST, parse it for function definitions
2282+
# Open Cython source file, create AST, parse it for function definitions
22822283
# and save them in a list
22832284
tree, _ = get_tree_and_language_info(resource.location)
22842285
function_definitions = [

scanpipe/tests/pipes/test_d2d.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,6 +1677,7 @@ def test_scanpipe_pipes_d2d_map_macho_symbols(self):
16771677
).count(),
16781678
)
16791679

1680+
@skipIf(sys.platform == "darwin", "Test is failing on macOS")
16801681
def test_scanpipe_pipes_d2d_map_python_pyx(self):
16811682
input_dir = self.project1.input_path
16821683
input_resources = [
@@ -1693,19 +1694,14 @@ def test_scanpipe_pipes_d2d_map_python_pyx(self):
16931694
for input_file_path in input_files:
16941695
scancode.extract_archive(input_file_path, codebase_path)
16951696

1696-
scancode.extract_archives(
1697-
self.project1.codebase_path,
1698-
recurse=True,
1699-
)
1697+
scancode.extract_archives(self.project1.codebase_path, recurse=True)
17001698
pipes.collect_and_create_codebase_resources(self.project1)
17011699
buffer = io.StringIO()
17021700
d2d.map_python_pyx_to_binaries(project=self.project1, logger=buffer.write)
1703-
self.assertEqual(
1704-
1,
1705-
CodebaseRelation.objects.filter(
1706-
project=self.project1, map_type="python_pyx_match"
1707-
).count(),
1701+
pyx_match_relations = CodebaseRelation.objects.filter(
1702+
project=self.project1, map_type="python_pyx_match"
17081703
)
1704+
self.assertEqual(1, pyx_match_relations.count())
17091705

17101706
@skipIf(sys.platform == "darwin", "Test is failing on macOS")
17111707
def test_scanpipe_pipes_d2d_map_winpe_symbols(self):

0 commit comments

Comments
 (0)