forked from gemfileparser/gemfileparser
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore a gemfileparser module for compatibility
This is breaking downstream users like ScanCode otherwise Reference: aboutcode-org/scancode-toolkit#3160 Reported-by: Daniel Thiele @danielthieleog Signed-off-by: Philippe Ombredanne <[email protected]>
- Loading branch information
1 parent
5b2f194
commit 0321d65
Showing
5 changed files
with
26 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
graft gemfileparser2 | ||
graft src | ||
graft tests | ||
|
||
include AUTHORS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
# compatibility import | ||
from gemfileparser2 import * # NOQA |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,8 @@ | |
# Copyright (c) Balasankar C <[email protected]> and others | ||
# SPDX-License-Identifier: GPL-3.0-or-later OR MIT | ||
|
||
import json | ||
import os | ||
|
||
from gemfileparser2 import GemfileParser | ||
|
||
TEST_DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') | ||
|
||
|
||
|
@@ -18,7 +15,16 @@ def check_gemparser_results(test_file, regen=False): | |
"-expected.json" suffix appended. | ||
""" | ||
test_file = os.path.join(TEST_DATA_DIR, test_file) | ||
gemparser = GemfileParser(test_file) | ||
|
||
from gemfileparser2 import GemfileParser as GemfileParser2 | ||
from gemfileparser import GemfileParser | ||
_check_gemparser_results(test_file, parser=GemfileParser, regen=regen) | ||
_check_gemparser_results(test_file, parser=GemfileParser2, regen=regen) | ||
|
||
|
||
def _check_gemparser_results(test_file, parser, regen=False): | ||
import json | ||
gemparser = parser(test_file) | ||
dependencies = { | ||
group: [dep.to_dict() for dep in deps] | ||
for group, deps in gemparser.parse().items() | ||
|
@@ -72,7 +78,7 @@ def test_gemspec_3(): | |
|
||
|
||
def test_gemspec_no_deps(): | ||
check_gemparser_results("gemspecs/arel2.gemspec", regen=False) | ||
check_gemparser_results("gemspecs/arel2.gemspec", regen=False) | ||
|
||
|
||
def test_gemspec_4(): | ||
|