#51 Python2 config-parser doesn't have fallback option in get.
Merged 4 years ago by nphilipp. Opened 4 years ago by asaleh.
fedora-infra/ asaleh/rpmautospec fix_fallback_py2  into  master

@@ -28,11 +28,13 @@ 

  

      base_url = CONFIG.get("pagure", "url")

      token = CONFIG.get("pagure", "token")

-     git_filter = CONFIG.get(

-         "pagure",

-         "git_filter",

-         fallback=r".*\.fedoraproject\.org/(?P<repo>rpms/.*)\.git#(?P<commit>[a-f0-9]{40})$",

-     )

+ 

+     git_filter = r".*\.fedoraproject\.org/(?P<repo>rpms/.*)\.git#(?P<commit>[a-f0-9]{40})$"

+     if CONFIG.has_option("pagure", "git_filter"):

+         git_filter = CONFIG.get(

+             "pagure",

+             "git_filter",

+         )

      git_filter_re = re.compile(git_filter)

  

      build = kwargs["build"]

@@ -13,6 +13,9 @@ 

      def get(self, section, key, **kwargs):

          return test_config.get(key, kwargs.get("fallback"))

  

+     def has_option(*args):

+         return False

Nasty, but works :)

+ 

  

  class TestRpmautospecHub:

      """Test the rpmautospec hub plugin for Koji."""