Skip to content

Commit

Permalink
Restore a gemfileparser module for compatibility
Browse files Browse the repository at this point in the history
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
pombredanne committed Nov 28, 2022
1 parent 5b2f194 commit 0321d65
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 8 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
graft gemfileparser2
graft src
graft tests

include AUTHORS
Expand Down
13 changes: 11 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,23 @@ classifiers =
Topic :: Utilities

[options]
zip_safe = False
include_package_data = True
package_dir =
=src
packages = find:
include_package_data = true
zip_safe = false

py_modules =
gemfileparser
gemfileparser2


setup_requires = setuptools_scm[toml] >= 4

python_requires = >=3.6.*

[options.packages.find]
where = src

[options.extras_require]
testing =
Expand Down
3 changes: 3 additions & 0 deletions src/gemfileparser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# compatibility import
from gemfileparser2 import * # NOQA
File renamed without changes.
16 changes: 11 additions & 5 deletions tests/test_gemfileparser2.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')


Expand All @@ -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()
Expand Down Expand Up @@ -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():
Expand Down

0 comments on commit 0321d65

Please sign in to comment.