From cc95bd1ca5e69ce13766ca0acea11560531ed620 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@fe.uni-lj.si>
Date: Tue, 24 May 2016 08:01:55 +0000
Subject: [PATCH] From snapshots, raw tape configuration is extracted and written into tape file and not the rendered one

---
 src/snapshot.c            |    2 +-
 python/trisurf/trisurf.py |   10 ++++++----
 build.sh                  |    3 ++-
 3 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/build.sh b/build.sh
index 1a24bc2..2ac3b5a 100755
--- a/build.sh
+++ b/build.sh
@@ -5,6 +5,7 @@
 automake -ac
 autoconf
 ./configure
+make clean
 make
-make install
+sudo make install
 
diff --git a/python/trisurf/trisurf.py b/python/trisurf/trisurf.py
index 310b4d3..bed6f7d 100644
--- a/python/trisurf/trisurf.py
+++ b/python/trisurf/trisurf.py
@@ -1,5 +1,3 @@
-#!/usr/bin/python3
-
 import configobj
 import xml.etree.ElementTree as ET
 import base64
@@ -84,6 +82,9 @@
 		'''
 		try:
 			self.config=configobj.ConfigObj(tape)
+			with open (tape, "r") as myfile:
+				self.rawText=myfile.read() #read the file
+
 		except:
 			print("Error reading or parsing tape file!\n")
 			exit(1)
@@ -91,6 +92,7 @@
 	def setTape(self, string):
 		'''Method setTape(string) parses the string in memory that hold the tape contents.'''
 		self.config=configobj.ConfigObj(io.StringIO(string))
+		self.rawText=string
 		return
 
 	def getValue(self,key):
@@ -364,8 +366,8 @@
 				else:
 					try:
 						with open (os.path.join(self.Dir.fullpath(),"tape"), "w") as myfile:
-							myfile.write("#This is automatically generated tape file from snapshot")
-							myfile.write(str(self.tape))
+							#myfile.write("#This is automatically generated tape file from snapshot")
+							myfile.write(str(self.tape.rawText))
 					except:
 						print("Error -- cannot make tapefile  "+ os.path.join(self.Dir.fullpath(),"tape")+" from the snapshot in the running directory")
 						exit(1)
diff --git a/src/snapshot.c b/src/snapshot.c
index 370ce4c..cabb1f8 100644
--- a/src/snapshot.c
+++ b/src/snapshot.c
@@ -57,7 +57,7 @@
 	fprintf(fh, "<trisurfversion>Trisurf (commit %s), compiled on %s %s</trisurfversion>\n",TS_VERSION, __DATE__,  __TIME__);
 	fprintf(fh, "<dumpdate>%s</dumpdate>\n", c_time_string);
 
-	fprintf(fh, "<tape>\n");
+	fprintf(fh, "<tape>");
 		fprintf(fh,"%s",tapetxt);	
 	fprintf(fh, "</tape>\n");
 	if(vesicle->poly_list!=NULL){

--
Gitblit v1.9.3