Summary: | Misc portage code cleanup. | ||
---|---|---|---|
Product: | Portage Development | Reporter: | Alec Warner (RETIRED) <antarus> |
Component: | Unclassified | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED WONTFIX | ||
Severity: | minor | Keywords: | Tracker |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- | |
Attachments: |
replace foo,bar -> foo, bar
"/"+x+":"+foo+".ebuild" -> "/" + x + ":" + foo + ".ebuild" |
Description
Alec Warner (RETIRED)
![]() ![]() ![]() Created attachment 198262 [details, diff]
replace foo,bar -> foo, bar
* (foo,bar) is ugly as sin, (foo, bar) is pretty.
* so is "from portage.const import foo,bar,baz,your,mom,says,hi"
* Some lines may exceed 80 chars with this patch
* I haven't tested it yet
* More patches coming
# Replace foo,bar with foo, bar
sed -i -re 's/(,)([^ ])/\1 \2/g' $(find . -name "*.py"
pym/portage/tests/runTests <snip snip> ---------------------------------------------------------------------- Ran 40 tests in 0.940s OK Created attachment 198279 [details, diff]
"/"+x+":"+foo+".ebuild" -> "/" + x + ":" + foo + ".ebuild"
doing all of +/*- was too destructive, so just + (the majority of the problem areas are string cats). I am attempting to invent a regex that will transform:
foo + "bar" + baz into stringify("%sbar%s", foo, baz) which Does The Right Thing (drtr).
(In reply to comment #1) > # Replace foo,bar with foo, bar > sed -i -re 's/(,)([^ ])/\1 \2/g' $(find . -name "*.py" This regex produces a couple classes of false positive that are annoying to sort out: @@ -1087,7 +1087,7 @@ return True def get_use(self, pkgname): - writemsg("deprecated use of binarytree.get_use()," + \ + writemsg("deprecated use of binarytree.get_use(), " + \ " use dbapi.aux_get() instead", noiselevel=-1) return self.dbapi.aux_get(pkgname, ["USE"])[0].split() @@ -387,7 +387,7 @@ for x in filter(None, fields[3].replace( "${ORIGIN}", os.path.dirname(obj)).replace( "$ORIGIN", os.path.dirname(obj)).split(":"))]) - needed = [x for x in fields[4].split(",") if x] + needed = [x for x in fields[4].split(", ") if x] obj_key = self._obj_key(obj) indexed = True Do you intend to work on that again in the future? Closing after the discussion on IRC. |