Merge lp://staging/~danilo/launchpad/bug-682186 into lp://staging/launchpad

Proposed by Данило Шеган
Status: Merged
Approved by: Данило Шеган
Approved revision: no longer in the source branch.
Merged at revision: 12066
Proposed branch: lp://staging/~danilo/launchpad/bug-682186
Merge into: lp://staging/launchpad
Diff against target: 62 lines (+28/-8)
2 files modified
lib/canonical/launchpad/tests/test_versioninfo.py (+24/-0)
lib/canonical/launchpad/versioninfo.py (+4/-8)
To merge this branch: bzr merge lp://staging/~danilo/launchpad/bug-682186
Reviewer Review Type Date Requested Status
Henning Eggers (community) code Approve
Aaron Bentley (community) Needs Fixing
Review via email: mp+43549@code.staging.launchpad.net

Commit message

[no-qa] [rollback=12041] [r=henninge][ui=none][bug=682186] Make LP versioninfo work for scripts as well (when CWD is not LP root).

Description of the change

= Bug 682186 =

Make sure versioninfo works correctly even when called from a script ran outside the LP root directory. Since all of our cronscripts are run from a different path with absolute command names (eg. $LP_PY $LP_ROOT/cronscripts/blahblah), nothing that uses versioninfo gets correct information in scripts.

This includes X-Generated-By headers in all LP emails and PO files generated by Launchpad.

I chatted extensively with Gary about this, and the actual fix is really his code (we've gone through a few variants through pastebins). I just triaged a bug, provided a test and worried about the bug fix. :)

I am also doing a follow-up branch which moves the versioninfo to lp.app, but that would make this branch more confusing so I split it up.

I am not really sure what can I do about the lint problems (other than make linter ignore them).

== Tests ==

bin/test -cvvt versioninfo

== Launchpad lint ==

Checking for conflicts and issues in changed files.

Linting changed files:
  lib/launchpadversioninfo.py
  lib/canonical/launchpad/versioninfo.py
  lib/canonical/launchpad/tests/test_versioninfo.py

./lib/launchpadversioninfo.py
      20: E303 too many blank lines (3)
./lib/canonical/launchpad/versioninfo.py
      42: undefined name 'InputError'

To post a comment you must log in.
Revision history for this message
Aaron Bentley (abentley) wrote :

I think you mean ImportError-- the linter is quite right to complain about InputError.

review: Needs Fixing
Revision history for this message
Данило Шеган (danilo) wrote :

Indeed, fixed.

Revision history for this message
Данило Шеган (danilo) wrote :

Lint is now clean.

Revision history for this message
Henning Eggers (henninge) wrote :

Looks good, thanks. ;)

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.