Gentoo Archives: gentoo-catalyst

From: Brian Dolbec <dolsen@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] [PATCH] lint: clean up global statement warnings
Date: Tue, 06 Oct 2015 06:13:10
Message-Id: 20151005231215.778f2cd7.dolsen@gentoo.org
In Reply to: [gentoo-catalyst] [PATCH] lint: clean up global statement warnings by Mike Frysinger
1 On Tue, 6 Oct 2015 00:16:35 -0400
2 Mike Frysinger <vapier@g.o> wrote:
3
4 > Delete unused calls and add disables for the ones we actively want.
5 > We generally want to avoid calls to "global" so force people to
6 > disable the warning whenever they try to use it.
7 > ---
8 > catalyst/support.py | 2 --
9 > catalyst/version.py | 2 ++
10 > setup.py | 3 ++-
11 > 3 files changed, 4 insertions(+), 3 deletions(-)
12 >
13 > diff --git a/catalyst/support.py b/catalyst/support.py
14 > index a879eaf..1e3eeef 100644
15 > --- a/catalyst/support.py
16 > +++ b/catalyst/support.py
17 > @@ -294,8 +294,6 @@ def ismount(path):
18 >
19 > def addl_arg_parse(myspec,addlargs,requiredspec,validspec):
20 > "helper function to help targets parse additional arguments"
21 > - global valid_config_file_values
22 > -
23 > messages = []
24 > for x in addlargs.keys():
25 > if x not in validspec and x not in
26 > valid_config_file_values and x not in requiredspec: diff --git
27 > a/catalyst/version.py b/catalyst/version.py index d5c5cde..5deb4d7
28 > 100644 --- a/catalyst/version.py
29 > +++ b/catalyst/version.py
30 > @@ -18,6 +18,7 @@ _ver = None
31 >
32 > def get_git_version(version=__version__):
33 > """Return: a string describing our version."""
34 > + # pylint: disable=global-statement
35 > global _ver
36 > cwd = os.path.dirname(os.path.abspath(__file__))
37 > version_info = get_ver(cwd)
38 > @@ -39,6 +40,7 @@ def get_version(reset=False):
39 > '''Returns a saved release version string or the
40 > generated git release version.
41 > '''
42 > + # pylint: disable=global-statement
43 > global __version__, _ver
44 > if _ver and not reset:
45 > return _ver
46 > diff --git a/setup.py b/setup.py
47 > index 27ed2de..e4569ee 100755
48 > --- a/setup.py
49 > +++ b/setup.py
50 > @@ -55,7 +55,6 @@ _data_files.extend(_files('share/catalyst/targets',
51 > 'targets')) class set_version(_Command):
52 > '''Saves the specified release version information
53 > '''
54 > - global __version__
55 > description = "hardcode script's version using VERSION from
56 > environment" user_options = [] # [(long_name, short_name, desc),]
57 >
58 > @@ -66,6 +65,8 @@ class set_version(_Command):
59 > pass
60 >
61 > def run(self):
62 > + # pylint: disable=global-statement
63 > + global __version__
64 > try:
65 > version = _os.environ['VERSION']
66 > except KeyError:
67
68 yes, :) looks good
69
70 --
71 Brian Dolbec <dolsen>