Gentoo Archives: gentoo-catalyst

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

Replies