diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-06-01 11:27:51 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-06-01 11:27:51 -0700 |
commit | ae229d84451f1751d33e02c743b82153431ed32e (patch) | |
tree | 53a5331cef6564a6b105f5b616b845c13f38293b | |
parent | 415d33de1692a65c60730da961ad3d787346b375 (diff) | |
download | portage-ae229d84451f1751d33e02c743b82153431ed32e.tar.gz portage-ae229d84451f1751d33e02c743b82153431ed32e.tar.bz2 portage-ae229d84451f1751d33e02c743b82153431ed32e.zip |
Add a Package.copy() method.
-rw-r--r-- | pym/_emerge/Package.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 845d30775..9df7b644c 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -23,7 +23,7 @@ class Package(Task): "category", "counter", "cp", "cpv_split", "inherited", "invalid", "iuse", "masks", "mtime", "pf", "pv_split", "root", "slot", "slot_atom", "visible",) + \ - ("_use",) + ("_raw_metadata", "_use",) metadata_keys = [ "BUILD_TIME", "CHOST", "COUNTER", "DEPEND", "EAPI", @@ -35,7 +35,8 @@ class Package(Task): def __init__(self, **kwargs): Task.__init__(self, **kwargs) self.root = self.root_config.root - self.metadata = _PackageMetadataWrapper(self, self.metadata) + self._raw_metadata = _PackageMetadataWrapperBase(self.metadata) + self.metadata = _PackageMetadataWrapper(self, self._raw_metadata) if not self.built: self.metadata['CHOST'] = self.root_config.settings.get('CHOST', '') self.cp = portage.cpv_getkey(self.cpv) @@ -53,6 +54,12 @@ class Package(Task): self.masks = self._masks() self.visible = self._visible(self.masks) + def copy(self): + return Package(built=self.built, cpv=self.cpv, depth=self.depth, + installed=self.installed, metadata=self._raw_metadata, + onlydeps=self.onlydeps, operation=self.operation, + root_config=self.root_config, type_name=self.type_name) + def _masks(self): masks = {} settings = self.root_config.settings |