diff --git a/hdlmake/fetch/backend_factory.py b/hdlmake/fetch/backend_factory.py
index d469e28c8d6849f68f16f4535b4b66398786bfb1..d872884ac5d0775e2f50be4e87ecfbaaf219e911 100644
--- a/hdlmake/fetch/backend_factory.py
+++ b/hdlmake/fetch/backend_factory.py
@@ -23,9 +23,10 @@ from git import (Git, GitSubmodule)
 from svn import Svn
 import logging
 import fetch
+from fetcher import Fetcher
 
 
-class Local(object):
+class Local(Fetcher):
     def __init__(self):
         pass
 
diff --git a/hdlmake/fetch/fetcher.py b/hdlmake/fetch/fetcher.py
new file mode 100644
index 0000000000000000000000000000000000000000..33cb71c0afe0b6572a11ef6c1a2a00f1f71a5f4d
--- /dev/null
+++ b/hdlmake/fetch/fetcher.py
@@ -0,0 +1,25 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (c) 2013 CERN
+# Author: Pawel Szostek (pawel.szostek@cern.ch)
+#
+# This file is part of Hdlmake.
+#
+# Hdlmake is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# Hdlmake is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Hdlmake.  If not, see <http://www.gnu.org/licenses/>.
+
+
+class Fetcher(object):
+    def fetch(self, module):
+        pass
\ No newline at end of file
diff --git a/hdlmake/fetch/git.py b/hdlmake/fetch/git.py
index 9dd94c57ef6dfe4429cdf17f2e319f470c744fea..d44d65c06eac6b0534deb8eedc5f239077788723 100644
--- a/hdlmake/fetch/git.py
+++ b/hdlmake/fetch/git.py
@@ -25,9 +25,10 @@ import logging
 from tempfile import TemporaryFile
 from subprocess import Popen, PIPE
 import fetch
+from fetcher import Fetcher
 
 
-class GitSubmodule(object):
+class GitSubmodule(Fetcher):
     def fetch(self, module):
         if module.source != fetch.GITSUBMODULE:
             raise ValueError("This backend should get git modules only.")
@@ -38,7 +39,7 @@ class GitSubmodule(object):
         os.chdir(cur_dir)
 
 
-class Git(object):
+class Git(Fetcher):
     def __init__(self):
         pass
 
@@ -46,31 +47,34 @@ class Git(object):
     def get_git_submodules(module):
         submodule_dir = path.rel2abs(module.path)
         logging.debug("Checking git submodules in %s" % submodule_dir)
-        curdir = os.getcwd()
-        os.chdir(submodule_dir)
-
-        #"git config --list" | grep submodule | sed 's/.*=//')" % submodule_dir
-        config_content = Popen("git config --list",
-                                  stdout=PIPE,
-                                  stdin=PIPE,
-                                  shell=True)
-        config_lines = [line.strip() for line in config_content.stdout.readlines()]
-        config_submodule_lines = [line for line in config_lines if "submodule" in line]
-        config_submodules = [line.split("=")[-1] for line in config_submodule_lines]
-
-        #"(cd %s && cat ./.gitmodules 2>/dev/null | grep url | sed 's/url = //')" % submodule_dir
+        cur_dir = os.getcwd()
         try:
-            dotgitmodules_file = open(".gitmodules", 'r')
-            dotgitmodules_lines = dotgitmodules_file.readlines()
-            url_lines = [line for line in dotgitmodules_lines if 'url' in line]
-            dotgitmodules_submodules = [line.split(" = ")[-1].strip() for line in url_lines]
-
-            set(config_submodules).update(set(dotgitmodules_submodules))
-        except IOError:
-            pass  # no .gitmodules file
-        submodules = list(config_submodules)
-        if len(submodules) > 0:
-            logging.info("Found git submodules in %s" % module.path)
+            os.chdir(submodule_dir)
+
+            #"git config --list" | grep submodule | sed 's/.*=//')" % submodule_dir
+            config_content = Popen("git config --list",
+                                      stdout=PIPE,
+                                      stdin=PIPE,
+                                      shell=True)
+            config_lines = [line.strip() for line in config_content.stdout.readlines()]
+            config_submodule_lines = [line for line in config_lines if "submodule" in line]
+            config_submodules = [line.split("=")[-1] for line in config_submodule_lines]
+
+            #"(cd %s && cat ./.gitmodules 2>/dev/null | grep url | sed 's/url = //')" % submodule_dir
+            try:
+                dotgitmodules_file = open(".gitmodules", 'r')
+                dotgitmodules_lines = dotgitmodules_file.readlines()
+                url_lines = [line for line in dotgitmodules_lines if 'url' in line]
+                dotgitmodules_submodules = [line.split(" = ")[-1].strip() for line in url_lines]
+
+                set(config_submodules).update(set(dotgitmodules_submodules))
+            except IOError:
+                pass  # no .gitmodules file
+            submodules = list(config_submodules)
+            if len(submodules) > 0:
+                logging.info("Found git submodules in %s" % module.path)
+        finally:
+            os.chdir(cur_dir)
         return submodules
 
     def fetch(self, module):
diff --git a/hdlmake/fetch/svn.py b/hdlmake/fetch/svn.py
index 7d9c477032ec2620e7dde31af6a896fd7982010d..96428fe17a06b69876a3ec4681328ffe774f2358 100644
--- a/hdlmake/fetch/svn.py
+++ b/hdlmake/fetch/svn.py
@@ -24,9 +24,10 @@ import logging
 from tempfile import TemporaryFile
 from util import path
 from subprocess import Popen, PIPE
+from fetcher import Fetcher
 
 
-class Svn(object):
+class Svn(Fetcher):
     def __init__(self):
         pass