Skip to content

Commit

Permalink
Fixing for pre-py3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkerz committed Oct 31, 2018
1 parent 15e0fd2 commit a96171e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pie_unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ def cmd(c,use_sudo=False):
sudo(c) if use_sudo else pie.cmd(c)

def sudo(c):
pie.cmd(f'sudo {c}')
pie.cmd('sudo {}'.format(c))


def set_permissions(p,mode=None,owner=None,group=None,use_sudo=False):
if mode: cmd(f'chmod {mode:04o} {p}',use_sudo)
if owner: cmd(f'chown {owner} {p}',use_sudo)
if group: cmd(f'chgrp {group} {p}',use_sudo)
if mode: cmd('chmod {:04o} {}'.format(mode,p),use_sudo)
if owner: cmd('chown {} {}'.format(owner,p),use_sudo)
if group: cmd('chgrp {} {}'.format(group,p),use_sudo)


def mkdir(p,mode=None,owner=None,group=None,use_sudo=False):
cmd(f'mkdir {p}',use_sudo)
cmd('mkdir {}'.format(p),use_sudo)
set_permissions(p,mode,owner,group,use_sudo)

def put_file(src,dest,mode=None,owner=None,group=None,use_sudo=False):
cmd(f'cp {src} {dest}',use_sudo)
cmd('cp {} {}'.format(src,dest),use_sudo)
set_permissions(dest,mode,owner,group,use_sudo)

0 comments on commit a96171e

Please sign in to comment.