# Store the path
self._set_attribute("path", path)
- def copy(self, dst):
- if os.path.isdir(dst):
- dst = os.path.join(dst, self.filename)
-
- if os.path.exists(dst):
- raise IOError("Destination file exists: %s" % dst)
-
- src = os.path.join(PACKAGES_DIR, self.path)
-
- log.debug("Copying %s to %s" % (src, dst))
-
- shutil.copy2(src, dst)
-
- def move(self, target_dir):
- # Create directory if it does not exist, yet.
- if not os.path.exists(target_dir):
- os.makedirs(target_dir)
-
- # Make full path where to put the file.
- target = os.path.join(target_dir, os.path.basename(self.path))
-
- # Copy the file to the target directory (keeping metadata).
- shutil.move(self.path, target)
-
- # Update file path in the database.
- self._set_attribute("path", os.path.relpath(target, PACKAGES_DIR))
-
@lazy_property
def build(self):
if self.job: