diff options
-rw-r--r-- | mirrorselect/configs.py | 2 | ||||
-rw-r--r-- | tests/test_write_make_conf.py | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/mirrorselect/configs.py b/mirrorselect/configs.py index df718f6..4cba14f 100644 --- a/mirrorselect/configs.py +++ b/mirrorselect/configs.py @@ -81,6 +81,8 @@ def write_make_conf(output, config_path, var, mirror_string): lex.quotes = "\"'" while True: key = lex.get_token() + if key is None: + break if key == var: begin_line = lex.lineno diff --git a/tests/test_write_make_conf.py b/tests/test_write_make_conf.py index 3dedd93..fb84978 100644 --- a/tests/test_write_make_conf.py +++ b/tests/test_write_make_conf.py @@ -23,6 +23,7 @@ class WriteMakeConfTestCase(unittest.TestCase): ('\n{}="foo \\\nbar"\n'.format(var), '\n{}\n'.format(mirror_string)), ('\n\n{}="foo \\\nbar"\n'.format(var), '\n\n{}\n'.format(mirror_string)), ('\n\n{}="foo \\\nbar"\na="b"\n'.format(var), '\n\na="b"\n{}\n'.format(mirror_string)), + ('', '{}\n'.format(mirror_string)), ) for make_conf, expected_result in cases: |