On Fri, Aug 28, 2015 at 01:47:31PM +0000, Eren Yagdiran wrote:
Any custom source provider can be added to virt-sandbox-image as a
source
---
.gitignore | 1 +
bin/Makefile.am | 16 ++++++++++++----
bin/virt-sandbox-image.in | 3 +++
configure.ac | 2 ++
virt-sandbox-image/Makefile.am | 13 +++++++++++++
virt-sandbox-image/sources/Source.py | 27 +++++++++++++++++++++++++++
virt-sandbox-image/sources/__init__.py | 26 ++++++++++++++++++++++++++
virt-sandbox-image/virt-sandbox-image.py | 15 +++++++++------
8 files changed, 93 insertions(+), 10 deletions(-)
create mode 100644 bin/virt-sandbox-image.in
create mode 100644 virt-sandbox-image/Makefile.am
create mode 100644 virt-sandbox-image/sources/Source.py
create mode 100644 virt-sandbox-image/sources/__init__.py
mode change 100644 => 100755 virt-sandbox-image/virt-sandbox-image.py
diff --git a/.gitignore b/.gitignore
index f77ea12..ef5b5aa 100644
--- a/.gitignore
+++ b/.gitignore
@@ -56,3 +56,4 @@ bin/virt-sandbox
bin/virt-sandbox-service-util
build/
bin/*.1
+bin/virt-sandbox-image
diff --git a/bin/Makefile.am b/bin/Makefile.am
index 416f86f..df4c7dc 100644
--- a/bin/Makefile.am
+++ b/bin/Makefile.am
@@ -3,7 +3,11 @@ bin_PROGRAMS = virt-sandbox
libexec_PROGRAMS = virt-sandbox-service-util
-bin_SCRIPTS = virt-sandbox-service
+bin_SCRIPTS = virt-sandbox-service \
+ virt-sandbox-image
+
+virt-sandbox-image: virt-sandbox-image.in
+ sed -e 's,[@]pkgpythondir[@],$(pkgpythondir),g' < $< >$@
virtsandboxcompdir = $(datarootdir)/bash-completion/completions/
@@ -20,8 +24,11 @@ POD_FILES = \
virt-sandbox-service-reload.pod \
virt-sandbox-service-upgrade.pod \
$(NULL)
-EXTRA_DIST = $(bin_SCRIPTS) $(POD_FILES) virt-sandbox-service-bash-completion.sh
virt-sandbox-service.logrotate
-EXTRA_DIST += virt-sandbox-service-bash-completion.sh
+EXTRA_DIST = virt-sandbox-service \
+ virt-sandbox-image.in \
+ $(POD_FILES) \
+ virt-sandbox-service-bash-completion.sh \
+ virt-sandbox-service.logrotate
man1_MANS = \
virt-sandbox.1 \
@@ -64,7 +71,8 @@ virt-sandbox-service-reload.1: virt-sandbox-service-reload.pod
Makefile
virt-sandbox-service-upgrade.1: virt-sandbox-service-upgrade.pod Makefile
$(AM_V_GEN)$(POD2MAN) $< $(srcdir)/$@
-CLEANFILES = $(man1_MANS)
+CLEANFILES = $(man1_MANS) \
+ virt-sandbox-image
virt_sandbox_SOURCES = virt-sandbox.c
virt_sandbox_CFLAGS = \
diff --git a/bin/virt-sandbox-image.in b/bin/virt-sandbox-image.in
new file mode 100644
index 0000000..732bb38
--- /dev/null
+++ b/bin/virt-sandbox-image.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exec "@pkgpythondir(a)/virt-sandbox-image.py" "$@"
Per my comment on patch 1, we can actually do this in python
#!/usr/bin/python
# -*- coding: utf-8 -*-
from libvirt_sandbox.image import cli
import sys
if __name__ == '__main__':
sys.exit(cli.main())
which nicely avoids the need to have a .in file text
substitution.
diff --git a/virt-sandbox-image/sources/Source.py
b/virt-sandbox-image/sources/Source.py
new file mode 100644
index 0000000..508ca80
--- /dev/null
+++ b/virt-sandbox-image/sources/Source.py
I'm thinking these will be best in libvirt-sandbox/image/sources/Source.py
so we get a python import module of 'libvirt_sandbox.image.sources.Source"
Regards,
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|