Skip to content

Commit

Permalink
Remove deprecated class
Browse files Browse the repository at this point in the history
  • Loading branch information
manzato committed Jan 25, 2017
1 parent c0de92b commit b00814d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pycall/callfile.py
Expand Up @@ -8,7 +8,7 @@
from tempfile import mkstemp
from os import chown, error, utime

from path import path
from path import Path

from .call import Call
from .actions import Action, Context
Expand Down Expand Up @@ -44,10 +44,10 @@ def __init__(self, call, action, archive=None, filename=None, tempdir=None,
self.spool_dir = spool_dir or self.DEFAULT_SPOOL_DIR

if filename and tempdir:
self.filename = path(filename)
self.tempdir = path(tempdir)
self.filename = Path(filename)
self.tempdir = Path(tempdir)
else:
f = path(mkstemp(suffix='.call')[1])
f = Path(mkstemp(suffix='.call')[1])
self.filename = f.name
self.tempdir = f.parent

Expand All @@ -73,7 +73,7 @@ def is_valid(self):
isinstance(self.action, Context)):
return False

if self.spool_dir and not path(self.spool_dir).abspath().isdir():
if self.spool_dir and not Path(self.spool_dir).abspath().isdir():
return False

if not self.call.is_valid():
Expand Down Expand Up @@ -112,7 +112,7 @@ def contents(self):

def writefile(self):
"""Write a temporary call file to disk."""
with open(path(self.tempdir) / path(self.filename), 'w') as f:
with open(Path(self.tempdir) / Path(self.filename), 'w') as f:
f.write(self.contents)

def spool(self, time=None):
Expand All @@ -134,7 +134,7 @@ def spool(self, time=None):
gid = pwd[3]

try:
chown(path(self.tempdir) / path(self.filename), uid, gid)
chown(Path(self.tempdir) / Path(self.filename), uid, gid)
except error:
raise NoUserPermissionError
except KeyError:
Expand All @@ -143,12 +143,12 @@ def spool(self, time=None):
if time:
try:
time = mktime(time.timetuple())
utime(path(self.tempdir) / path(self.filename), (time, time))
utime(Path(self.tempdir) / Path(self.filename), (time, time))
except (error, AttributeError, OverflowError, ValueError):
raise InvalidTimeError

try:
move(path(self.tempdir) / path(self.filename),
path(self.spool_dir) / path(self.filename))
move(Path(self.tempdir) / Path(self.filename),
Path(self.spool_dir) / Path(self.filename))
except IOError:
raise NoSpoolPermissionError

0 comments on commit b00814d

Please sign in to comment.