It is more normal to have python source files in all lowercase,
so rename the existing modules.
---
libvirt-sandbox/image/sources/Makefile.am | 6 +++---
libvirt-sandbox/image/sources/{Source.py => base.py} | 0
libvirt-sandbox/image/sources/{DockerSource.py => docker.py} | 4 ++--
.../image/sources/{VirtBuilderSource.py => virtbuilder.py} | 6 ++++--
libvirt-sandbox/image/template.py | 4 ++--
5 files changed, 11 insertions(+), 9 deletions(-)
rename libvirt-sandbox/image/sources/{Source.py => base.py} (100%)
rename libvirt-sandbox/image/sources/{DockerSource.py => docker.py} (99%)
rename libvirt-sandbox/image/sources/{VirtBuilderSource.py => virtbuilder.py} (98%)
diff --git a/libvirt-sandbox/image/sources/Makefile.am
b/libvirt-sandbox/image/sources/Makefile.am
index 52e9a7e..817baa0 100644
--- a/libvirt-sandbox/image/sources/Makefile.am
+++ b/libvirt-sandbox/image/sources/Makefile.am
@@ -2,9 +2,9 @@
pythonimagedir = $(pythondir)/libvirt_sandbox/image/sources
pythonimage_DATA = \
__init__.py \
- Source.py \
- DockerSource.py \
- VirtBuilderSource.py \
+ base.py \
+ docker.py \
+ virtbuilder.py \
$(NULL)
EXTRA_DIST = $(pythonimage_DATA)
diff --git a/libvirt-sandbox/image/sources/Source.py
b/libvirt-sandbox/image/sources/base.py
similarity index 100%
rename from libvirt-sandbox/image/sources/Source.py
rename to libvirt-sandbox/image/sources/base.py
diff --git a/libvirt-sandbox/image/sources/DockerSource.py
b/libvirt-sandbox/image/sources/docker.py
similarity index 99%
rename from libvirt-sandbox/image/sources/DockerSource.py
rename to libvirt-sandbox/image/sources/docker.py
index fb21bda..275a082 100644
--- a/libvirt-sandbox/image/sources/DockerSource.py
+++ b/libvirt-sandbox/image/sources/docker.py
@@ -21,7 +21,6 @@
# Author: Eren Yagdiran <erenyagdiran(a)gmail.com>
#
-from Source import Source
import urllib2
import sys
import json
@@ -31,6 +30,7 @@ import subprocess
import shutil
import urlparse
+from . import base
class DockerConfParser():
@@ -48,7 +48,7 @@ class DockerConfParser():
else:
return []
-class DockerSource(Source):
+class DockerSource(base.Source):
def _check_cert_validate(self):
major = sys.version_info.major
diff --git a/libvirt-sandbox/image/sources/VirtBuilderSource.py
b/libvirt-sandbox/image/sources/virtbuilder.py
similarity index 98%
rename from libvirt-sandbox/image/sources/VirtBuilderSource.py
rename to libvirt-sandbox/image/sources/virtbuilder.py
index 1c7ea49..6dfa6df 100644
--- a/libvirt-sandbox/image/sources/VirtBuilderSource.py
+++ b/libvirt-sandbox/image/sources/virtbuilder.py
@@ -19,12 +19,14 @@
# Author: Cedric Bosdonnat <cbosdonnat(a)suse.com>
#
-from Source import Source
import os
import os.path
import subprocess
-class VirtBuilderSource(Source):
+from . import base
+
+
+class VirtBuilderSource(base.Source):
def _get_template_name(self, template):
# We shouldn't have '/' in the names, but let's make sure
diff --git a/libvirt-sandbox/image/template.py b/libvirt-sandbox/image/template.py
index 58904a2..751cd4b 100644
--- a/libvirt-sandbox/image/template.py
+++ b/libvirt-sandbox/image/template.py
@@ -64,11 +64,11 @@ class Template(object):
try:
p = re.compile("\W")
+ sourcemod = "".join(p.split(self.source))
sourcename = "".join([i.capitalize() for i in
p.split(self.source)])
mod = importlib.import_module(
- "libvirt_sandbox.image.sources." +
- sourcename + "Source")
+ "libvirt_sandbox.image.sources." + sourcemod)
classname = sourcename + "Source"
classimpl = getattr(mod, classname)
return classimpl()
--
2.7.4