1 |
On Mon, 14 Mar 2016 10:35:26 -0700 |
2 |
Brian Dolbec <dolsen@g.o> wrote: |
3 |
|
4 |
> On Mon, 14 Mar 2016 10:14:15 -0700 |
5 |
> Zac Medico <zmedico@g.o> wrote: |
6 |
> |
7 |
> > On 03/05/2016 01:37 PM, Brian Dolbec wrote: |
8 |
> > |
9 |
|
10 |
> > Also, I see that the number of sys.exit calls in pym/repoman is up |
11 |
> > from 37 to 41. I would prefer that we raise exceptions for the |
12 |
> > caller to handle, rather than call sys.exit directly. I suppose we |
13 |
> > change that later though, after we merge the code. |
14 |
> > -- |
15 |
> > Thanks, |
16 |
> > Zac |
17 |
> > |
18 |
> |
19 |
> hmm, I don't recall adding any, that doesn't sound like me. I did |
20 |
> cringe a little every time I came across them. I do agree that they |
21 |
> need a better system. But I was concentrating on the modularization. |
22 |
> |
23 |
> Rather than wrapping the modules in try: except: pairs, perhaps we |
24 |
> could add another variable to the dynamic_data similar to "continue", |
25 |
> only an abandon-ship one, maybe "abort" to take them out of the |
26 |
> modules. Then the Scanner class could handle the exit in one |
27 |
> consistent place. Try/except can work nicely, but I've had to disable |
28 |
> far too many to troubleshoot code from their misuse and being nested 5 |
29 |
> or more deep. |
30 |
> |
31 |
|
32 |
Ok, I just had a look through to see about changing those. Many of |
33 |
those "New" sys.exit calls are due to code duplication moving from |
34 |
code blocks which handled multiple VCS types into the separate vcs |
35 |
modules, and at least 4 of those are in docstring comments. |
36 |
|
37 |
So, we should probably define an exception for those to raise. And |
38 |
hopefully find a nice central place to handle them correctly. |
39 |
|
40 |
We can do that in master before we make the .29 release I think. |
41 |
|
42 |
There are 3 in non-vcs code, 1 in the scan() in modules/scan/scan.py |
43 |
and 2 in modules, one of which is an import failure exit for the |
44 |
metadata.xml module. The other is in the manifest module code which |
45 |
looks like it could easily return {"continue": False, "abort": true} |
46 |
and handle the case in the Scanner class. That would also allow for |
47 |
future modules to make use of an "abort" if needed. |
48 |
|
49 |
As for the others, That is something we can work on in stage3 which was |
50 |
intended for fixing up the remaining (crappy) code and optimizing... |
51 |
|
52 |
-- |
53 |
Brian Dolbec <dolsen> |