summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlec Warner <antarus@gentoo.org>2007-01-13 19:25:20 +0000
committerAlec Warner <antarus@gentoo.org>2007-01-13 19:25:20 +0000
commit3e8a638793af3b001843055e8928cdb79e8afb79 (patch)
treee70a10ae0a11bc094db9abf2b66d797f9af41429
parentmake sure people call addread/addwrite/adddeny/addpredict correctly (diff)
downloadportage-idfetch-3e8a638793af3b001843055e8928cdb79e8afb79.tar.gz
portage-idfetch-3e8a638793af3b001843055e8928cdb79e8afb79.tar.bz2
portage-idfetch-3e8a638793af3b001843055e8928cdb79e8afb79.zip
fix tabs with patch from Grobian and bug # 161911, fix developing a bit
svn path=/main/trunk/; revision=5633
-rw-r--r--DEVELOPING12
-rw-r--r--pym/portage.py2
-rw-r--r--tests/portage_dep/test_dep_getcpv.py6
-rw-r--r--tests/portage_dep/test_dep_getslot.py10
-rw-r--r--tests/portage_dep/test_isjustname.py2
-rw-r--r--tests/portage_dep/test_isvalidatom.py6
6 files changed, 17 insertions, 21 deletions
diff --git a/DEVELOPING b/DEVELOPING
index 0530d99c..01eb9bd4 100644
--- a/DEVELOPING
+++ b/DEVELOPING
@@ -56,16 +56,12 @@ Generally you can do two things here, if you are messing with defaults..
dict.get(foo, some_default)
will try to retrieve foo from dict, if there is a KeyError, will insert foo
-into dict with the value of some_default. This method is preferred in most cases.
-
-You can also do something like:
+into dict with the value of some_default. This method is preferred in cases where
+you are messing with defaults:
try:
dict[foo]
- ...stuff here..
except KeyError:
- print "holy cow we totally expected a keyerror here"
+ dict[foo] = default_value
-in most instances however you are only catching the KeyError to set a default,
-in which case you should be using dict.get() or telling the user they are missing
-a required dict key.
+The get call is nicer (compact) and faster (try,except are slow).
diff --git a/pym/portage.py b/pym/portage.py
index bcbb376f..ee2dd5ef 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -2618,7 +2618,7 @@ def digestgen(myarchives, mysettings, overwrite=1, manifestonly=0, myportdb=None
NOTE: manifestonly and overwrite are useless with manifest2 and
are therefore ignored."""
if myportdb is None:
- writemsg("Warning: myportdb not specified to digestgen\n")
+ writemsg("Warning: myportdb not specified to digestgen\n")
global portdb
myportdb = portdb
global _doebuild_manifest_exempt_depend
diff --git a/tests/portage_dep/test_dep_getcpv.py b/tests/portage_dep/test_dep_getcpv.py
index 3652169d..d4d78d9a 100644
--- a/tests/portage_dep/test_dep_getcpv.py
+++ b/tests/portage_dep/test_dep_getcpv.py
@@ -7,10 +7,10 @@ from unittest import TestCase
from portage_dep import dep_getcpv
class DepGetCPV(TestCase):
- """ A simple testcase for isvalidatom
- """
+ """ A simple testcase for isvalidatom
+ """
- def testDepGetCPV(self):
+ def testDepGetCPV(self):
prefix_ops = ["<", ">", "=", "~", "!", "<=",
">=", "!=", "!<", "!>", "!~",""]
diff --git a/tests/portage_dep/test_dep_getslot.py b/tests/portage_dep/test_dep_getslot.py
index fc5a6e3c..9801e064 100644
--- a/tests/portage_dep/test_dep_getslot.py
+++ b/tests/portage_dep/test_dep_getslot.py
@@ -7,11 +7,11 @@ from unittest import TestCase
from portage_dep import dep_getslot
class DepGetSlot(TestCase):
- """ A simple testcase for isvalidatom
- """
+ """ A simple testcase for isvalidatom
+ """
+
+ def testDepGetSlot(self):
- def testDepGetSlot(self):
-
slot_char = ":"
slots = ( "a", "1.2", "1", "IloveVapier", None )
cpvs = ["sys-apps/portage"]
@@ -20,7 +20,7 @@ class DepGetSlot(TestCase):
for slot in slots:
if slot:
self.assertEqual( dep_getslot(
- cpv + slot_char + slot ), slot )
+ cpv + slot_char + slot ), slot )
else:
self.assertEqual( dep_getslot( cpv ), slot )
diff --git a/tests/portage_dep/test_isjustname.py b/tests/portage_dep/test_isjustname.py
index 1e152e73..32422441 100644
--- a/tests/portage_dep/test_isjustname.py
+++ b/tests/portage_dep/test_isjustname.py
@@ -8,7 +8,7 @@ from portage_dep import isjustname
class IsJustName(TestCase):
- def testIsJustName(self):
+ def testIsJustName(self):
cats = ( "", "sys-apps/", "foo/", "virtual/" )
pkgs = ( "portage", "paludis", "pkgcore", "notARealPkg" )
diff --git a/tests/portage_dep/test_isvalidatom.py b/tests/portage_dep/test_isvalidatom.py
index f1410366..ed66b348 100644
--- a/tests/portage_dep/test_isvalidatom.py
+++ b/tests/portage_dep/test_isvalidatom.py
@@ -7,10 +7,10 @@ from unittest import TestCase
from portage_dep import isvalidatom
class IsValidAtom(TestCase):
- """ A simple testcase for isvalidatom
- """
+ """ A simple testcase for isvalidatom
+ """
- def testIsValidAtom(self):
+ def testIsValidAtom(self):
tests = [ ( "sys-apps/portage", True ),
( "=sys-apps/portage-2.1", True ),