Skip to content
Browse files

Move delete function to

This makes it easier to reuse in other places.
  • Loading branch information
aneeshusa committed Apr 18, 2017
1 parent 7413c71 commit b1824f7a05078910e16ba466f107c1a3db6839cd
Showing with 14 additions and 12 deletions.
  1. +1 −7 python/servo/
  2. +13 −5 python/servo/
@@ -33,13 +33,7 @@

def delete(path):
os.remove(path) # Succeeds if path was a file
except OSError: # Or, if path was a directory...
shutil.rmtree(path) # Remove it and all its contents.
from servo.util import delete

def otool(s):
@@ -10,16 +10,24 @@
from __future__ import absolute_import, print_function, unicode_literals

import os
import os.path as path
import os.path
import platform
import sys
import shutil
from socket import error as socket_error
import StringIO
import sys
import tarfile
import zipfile
import urllib2

def delete(path):
if os.path.isdir(path) and not os.path.islink(path):

def host_platform():
os_type = platform.system().lower()
if os_type == "linux":
@@ -126,7 +134,7 @@ def download_bytes(desc, src):
def download_file(desc, src, dst):
tmp_path = dst + ".part"
start_byte = path.getsize(tmp_path)
start_byte = os.path.getsize(tmp_path)
with open(tmp_path, 'ab') as fd:
download(desc, src, fd, start_byte=start_byte)
except os.error:
@@ -143,8 +151,8 @@ def extract(src, dst, movedir=None):

if movedir:
for f in os.listdir(movedir):
frm = path.join(movedir, f)
to = path.join(dst, f)
frm = os.path.join(movedir, f)
to = os.path.join(dst, f)
os.rename(frm, to)

0 comments on commit b1824f7

Please sign in to comment.
You can’t perform that action at this time.