repoman: export GPG_TTY for bug #477728
[portage.git] / DEVELOPING
index cd9f78f9460d95b5291c1ccfd20486ca41b125a7..5f15e1590a481ebf7f5548a449facc96270f5546 100644 (file)
@@ -5,6 +5,21 @@ sense, they are pretty basic and mostly apply to old code.  However for people
 who are looking at current code, they make take up bad habits that exist in the
 current codebase.
 
+Python Version
+--------------
+
+Python 2.6 is the minimum supported version, since it is the first version to
+support Python 3 syntax. All exception handling should use Python 3 'except'
+syntax, and the print function should be used instead of Python 2's print
+statement (from __future__ import print_function).
+
+Dependencies
+------------
+
+Python and Bash should be the only hard dependencies. Any other dependencies,
+including external Python modules that are not included with Python itself,
+must be optionally enabled by run-time detection.
+
 Tabs
 ----
 
@@ -33,31 +48,10 @@ The mixing of tabs and spaces means other developers can't read what you did.
 This is why the python peps state spaces over tabs; because with spaces the line
 wrapping is always clear (but you cannot convert spaces as easily as tabwidth).
 
-String
--------
-Try not to use the functions in the string module, they are deprecated.
-
-string.join(<iterable>," ")
-
-should be replaced with:
-
-" ".join(<iterable>)
-
-and:
-
-string.split(string, delimeter)
-
-should be replaced with:
-
-"somestring".split(delimeter)
-
-Nearly all other methods in string work on string objects and have similar calling
-conventions.
-
 Comparisons
 -----------
 
-if foo == None
+if foo != None
 
 should be replaced with:
 
@@ -94,6 +88,18 @@ except KeyError:
 
 The get call is nicer (compact) and faster (try,except are slow).
 
+Exceptions
+----------
+
+Don't use the format raise Exception, "string"
+It will be removed in py3k.
+
+YES:
+  raise KeyError("No key")
+
+NO:
+  raise KeyError, "No key"
+
 Imports
 -------
 
@@ -153,13 +159,4 @@ just COLOR.  However it means during introspection of the current namespace
 The NO example just imports a set of functions from the output module.  It is
 somewhat annoying because the import line needs to be modified when functions
 are needed and often unused functions are left in the import line until someone
-comes along with a linter to clean up (does not happen often).  The color is a
-bit clearer as
-
-  print red('blar')
-
-is shorter than:
-
-  print output.red('blar')
-
-Rationale: python -c 'import portage; dir(portage)' (circa 02/2008)
+comes along with a linter to clean up (does not happen often).