archive: if using local file, avoid error trying to copy file to itself

This commit is contained in:
Dan Streetman 2020-01-21 13:31:10 -05:00
parent f026b5d597
commit 63f614ebe3

View File

@ -471,8 +471,11 @@ class SourcePackage(object):
if urlparse(url).scheme in ["", "file"]:
frompath = os.path.abspath(urlparse(url).path)
Logger.info("Copying %s from %s" % (filename, frompath))
shutil.copyfile(frompath, pathname)
if frompath == pathname:
Logger.info("Using %s" % pathname)
else:
Logger.info("Copying %s from %s" % (filename, frompath))
shutil.copyfile(frompath, pathname)
else:
try:
with closing(urlopen(url)) as f: