Skip to content

Commit 5b2f194

Browse files
authored
Merge pull request #7 from nexB/no-deps
Support parsing gemspecs with no deps.
2 parents d68d368 + 9edf2fc commit 5b2f194

25 files changed

Lines changed: 83 additions & 19 deletions

gemfileparser2/__init__.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,26 @@
1414
import os
1515
import re
1616

17+
TRACE = False
18+
19+
20+
def logger_debug(*args):
21+
pass
22+
23+
24+
if TRACE:
25+
import logging
26+
import sys
27+
28+
logger = logging.getLogger(__name__)
29+
logging.basicConfig(stream=sys.stdout)
30+
logger.setLevel(logging.DEBUG)
31+
32+
def logger_debug(*args):
33+
return logger.debug(' '.join(isinstance(a, str) and a or repr(a) for a in args))
34+
35+
logger_debug = print
36+
1737

1838
class Dependency(object):
1939
"""
@@ -157,10 +177,17 @@ def parse_gemfile(self):
157177
# Gemfile contains a call to gemspec
158178
gemfiledir = os.path.dirname(self.filepath)
159179
gemspec_list = glob.glob(os.path.join(gemfiledir, "*.gemspec"))
180+
181+
if not gemspec_list:
182+
logger_debug(f"No gemspec files found: {gemspec_list}")
183+
continue
184+
160185
if len(gemspec_list) > 1:
161-
print("Multiple gemspec files found")
186+
logger_debug("Multiple gemspec files found")
162187
continue
188+
163189
gemspec_file = gemspec_list[0]
190+
# FIXME: the path is not used
164191
self.parse_gemspec(path=os.path.join(gemfiledir, gemspec_file))
165192

166193
elif line.startswith("gem "):

tests/README.rst

Lines changed: 0 additions & 2 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)