public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] [PATCH] support: use snakeoil.fileutils.touch
@ 2015-10-08 21:29 Mike Frysinger
  2015-10-09  1:40 ` Brian Dolbec
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2015-10-08 21:29 UTC (permalink / raw
  To: gentoo-catalyst

No point in duplicating our own when snakeoil provides a better one.
---
 catalyst/base/resume.py    | 5 +++--
 catalyst/base/stagebase.py | 6 ++++--
 catalyst/support.py        | 8 --------
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/catalyst/base/resume.py b/catalyst/base/resume.py
index e3f03e7..443b46d 100644
--- a/catalyst/base/resume.py
+++ b/catalyst/base/resume.py
@@ -15,8 +15,9 @@ import os
 import sys
 import traceback
 
+from snakeoil import fileutils
+
 from catalyst.fileops import ensure_dirs, pjoin, listdir_files, clear_dir
-from catalyst.support import touch
 
 
 class AutoResumeError(Exception):
@@ -69,7 +70,7 @@ class AutoResume(object):
 				myf.write(data)
 		else:
 			try:
-				touch(fname)
+				fileutils.touch(fname)
 				self._points[point] = fname
 			except Exception as e:
 				print AutoResumeError(str(e))
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 813e5f1..f81c51b 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -9,12 +9,14 @@ from stat import ST_UID, ST_GID, ST_MODE
 # for convienience
 pjoin = os.path.join
 
+from snakeoil import fileutils
+
 from DeComp.compress import CompressMap
 
 from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS, TARGET_MOUNT_DEFAULTS,
 	PORT_LOGDIR_CLEAN)
 from catalyst.support import (CatalystError, msg, file_locate, normpath,
-	touch, cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount,
+	cmd, warn, list_bashify, read_makeconf, read_from_clst, ismount,
 	file_check)
 from catalyst.base.targetbase import TargetBase
 from catalyst.base.clearbase import ClearBase
@@ -1513,7 +1515,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
 						cmd(self.settings["controller_file"]+\
 							" build_packages "+mypack,\
 							"Error in attempt to build packages",env=self.env)
-						touch(build_packages_resume)
+						fileutils.touch(build_packages_resume)
 						self.resume.enable("build_packages")
 					except CatalystError:
 						self.unbind()
diff --git a/catalyst/support.py b/catalyst/support.py
index 1207d36..960a91d 100644
--- a/catalyst/support.py
+++ b/catalyst/support.py
@@ -250,14 +250,6 @@ def addl_arg_parse(myspec,addlargs,requiredspec,validspec):
 		raise CatalystError('\n\tAlso: '.join(messages))
 
 
-def touch(myfile):
-	try:
-		myf=open(myfile,"w")
-		myf.close()
-	except IOError:
-		raise CatalystError("Could not touch "+myfile+".", print_traceback=True)
-
-
 def countdown(secs=5, doing="Starting"):
 	if secs:
 		print ">>> Waiting",secs,"seconds before starting..."
-- 
2.5.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [gentoo-catalyst] [PATCH] support: use snakeoil.fileutils.touch
  2015-10-08 21:29 [gentoo-catalyst] [PATCH] support: use snakeoil.fileutils.touch Mike Frysinger
@ 2015-10-09  1:40 ` Brian Dolbec
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Dolbec @ 2015-10-09  1:40 UTC (permalink / raw
  To: gentoo-catalyst

On Thu,  8 Oct 2015 17:29:12 -0400
Mike Frysinger <vapier@gentoo.org> wrote:

> No point in duplicating our own when snakeoil provides a better one.
> ---
>  catalyst/base/resume.py    | 5 +++--
>  catalyst/base/stagebase.py | 6 ++++--
>  catalyst/support.py        | 8 --------
>  3 files changed, 7 insertions(+), 12 deletions(-)
> 
> diff --git a/catalyst/base/resume.py b/catalyst/base/resume.py
> index e3f03e7..443b46d 100644
> --- a/catalyst/base/resume.py
> +++ b/catalyst/base/resume.py
> @@ -15,8 +15,9 @@ import os
>  import sys
>  import traceback
>  
> +from snakeoil import fileutils
> +
>  from catalyst.fileops import ensure_dirs, pjoin, listdir_files,
> clear_dir -from catalyst.support import touch
>  
>  
>  class AutoResumeError(Exception):
> @@ -69,7 +70,7 @@ class AutoResume(object):
>  				myf.write(data)
>  		else:
>  			try:
> -				touch(fname)
> +				fileutils.touch(fname)
>  				self._points[point] = fname
>  			except Exception as e:
>  				print AutoResumeError(str(e))
> diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
> index 813e5f1..f81c51b 100644
> --- a/catalyst/base/stagebase.py
> +++ b/catalyst/base/stagebase.py
> @@ -9,12 +9,14 @@ from stat import ST_UID, ST_GID, ST_MODE
>  # for convienience
>  pjoin = os.path.join
>  
> +from snakeoil import fileutils
> +
>  from DeComp.compress import CompressMap
>  
>  from catalyst.defaults import (SOURCE_MOUNT_DEFAULTS,
> TARGET_MOUNT_DEFAULTS, PORT_LOGDIR_CLEAN)
>  from catalyst.support import (CatalystError, msg, file_locate,
> normpath,
> -	touch, cmd, warn, list_bashify, read_makeconf,
> read_from_clst, ismount,
> +	cmd, warn, list_bashify, read_makeconf, read_from_clst,
> ismount, file_check)
>  from catalyst.base.targetbase import TargetBase
>  from catalyst.base.clearbase import ClearBase
> @@ -1513,7 +1515,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
>  						cmd(self.settings["controller_file"]+\
>  							"
> build_packages "+mypack,\ "Error in attempt to build
> packages",env=self.env)
> -
> touch(build_packages_resume)
> +
> fileutils.touch(build_packages_resume)
> self.resume.enable("build_packages") except CatalystError:
>  						self.unbind()
> diff --git a/catalyst/support.py b/catalyst/support.py
> index 1207d36..960a91d 100644
> --- a/catalyst/support.py
> +++ b/catalyst/support.py
> @@ -250,14 +250,6 @@ def
> addl_arg_parse(myspec,addlargs,requiredspec,validspec): raise
> CatalystError('\n\tAlso: '.join(messages)) 
>  
> -def touch(myfile):
> -	try:
> -		myf=open(myfile,"w")
> -		myf.close()
> -	except IOError:
> -		raise CatalystError("Could not touch "+myfile+".",
> print_traceback=True) -
> -
>  def countdown(secs=5, doing="Starting"):
>  	if secs:
>  		print ">>> Waiting",secs,"seconds before starting..."


looks good :)

-- 
Brian Dolbec <dolsen>



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-09  1:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-08 21:29 [gentoo-catalyst] [PATCH] support: use snakeoil.fileutils.touch Mike Frysinger
2015-10-09  1:40 ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox