diff options
author | Dmitry Selyutin <ghostmansd@gmail.com> | 2017-09-08 18:34:58 +0300 |
---|---|---|
committer | Dmitry Selyutin <ghostmansd@gmail.com> | 2017-09-08 18:34:58 +0300 |
commit | 21c52a82444a2f5f3307c7e2c1212beac42b9938 (patch) | |
tree | e8e23e3cf3377bf8f202cd661b0a8f87c7ef07ad /pygnulib/GLInfo.py | |
parent | 4be624beba67fb2e6afd981be32b45fe73ecafb2 (diff) | |
download | gnulib-21c52a82444a2f5f3307c7e2c1212beac42b9938.tar.gz |
[pygnulib] autopep8 (fixing indentation, style, etc.)
Diffstat (limited to 'pygnulib/GLInfo.py')
-rw-r--r-- | pygnulib/GLInfo.py | 155 |
1 files changed, 77 insertions, 78 deletions
diff --git a/pygnulib/GLInfo.py b/pygnulib/GLInfo.py index 646b20cf65..71f19ca2c9 100644 --- a/pygnulib/GLInfo.py +++ b/pygnulib/GLInfo.py @@ -48,72 +48,72 @@ relpath = os.path.relpath # Define GLInfo class #=============================================================================== class GLInfo(object): - '''This class is used to get fromatted information about gnulib-tool. - This information is mainly used in stdout messages, but can be used - anywhere else. The return values are not the same as for the module, - but still depends on them.''' - - def __repr__(self): - '''x.__repr__ <==> repr(x)''' - result = '<pygnulib.GLInfo %s>' % hex(id(self)) - return(result) - - def package(self): - '''Return formatted string which contains name of the package.''' - result = 'GNU gnulib' - return(result) - - def authors(self): - '''Return formatted string which contains authors. - The special __author__ variable is used (type is list).''' - result = string() - for item in __author__: - if item == __author__[-2]: - result += '%s ' % item - elif item == __author__[-1]: - result += 'and %s' % item - else: - result += '%s, ' % item - return(result) - - def license(self): - '''Return formatted string which contains license and its description.''' - result = 'License GPLv3+: GNU GPL version 3 or later' - result += ' <http://gnu.org/licenses/gpl.html>\n' - result += 'This is free software: you are free' - result += ' to change and redistribute it.\n' - result += 'There is NO WARRANTY, to the extent permitted by law.' - return(result) - - def copyright(self): - '''Return formatted string which contains copyright. - The special __copyright__ variable is used (type is str).''' - result = 'Copyright (C) %s' % __copyright__ - return(result) - - def date(self): - '''Return formatted string which contains date and time in GMT format.''' - if isdir(DIRS['git']): - counter = int() # Create counter - result = string() # Create string - args = ['git', 'log'] - result = sp.check_output(args).decode("UTF-8") - # Get date as "Fri Mar 21 07:16:51 2008 -0600" from string - pattern = re.compile('Date:[\t ]*(.*?)$', re.S | re.M) - result = pattern.findall(result)[0] - # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600" - pattern = re.compile('^[^ ]* ([^ ]*) ([0-9]*) ([0-9:]*) ([0-9]*) ') - result = pattern.sub('\\1 \\2 \\4 \\3 ', result) - # Use GNU date to compute the time in GMT - args = ['date', '-d', result, '-u', '+%Y-%m-%d %H:%M:%S'] - proc = sp.check_output(args) - result = string(proc, "UTF-8") - result = result.rstrip(os.linesep) - return(result) - - def usage(self): - '''Show help message.''' - result = '''\ + '''This class is used to get fromatted information about gnulib-tool. + This information is mainly used in stdout messages, but can be used + anywhere else. The return values are not the same as for the module, + but still depends on them.''' + + def __repr__(self): + '''x.__repr__ <==> repr(x)''' + result = '<pygnulib.GLInfo %s>' % hex(id(self)) + return(result) + + def package(self): + '''Return formatted string which contains name of the package.''' + result = 'GNU gnulib' + return(result) + + def authors(self): + '''Return formatted string which contains authors. + The special __author__ variable is used (type is list).''' + result = string() + for item in __author__: + if item == __author__[-2]: + result += '%s ' % item + elif item == __author__[-1]: + result += 'and %s' % item + else: + result += '%s, ' % item + return(result) + + def license(self): + '''Return formatted string which contains license and its description.''' + result = 'License GPLv3+: GNU GPL version 3 or later' + result += ' <http://gnu.org/licenses/gpl.html>\n' + result += 'This is free software: you are free' + result += ' to change and redistribute it.\n' + result += 'There is NO WARRANTY, to the extent permitted by law.' + return(result) + + def copyright(self): + '''Return formatted string which contains copyright. + The special __copyright__ variable is used (type is str).''' + result = 'Copyright (C) %s' % __copyright__ + return(result) + + def date(self): + '''Return formatted string which contains date and time in GMT format.''' + if isdir(DIRS['git']): + counter = int() # Create counter + result = string() # Create string + args = ['git', 'log'] + result = sp.check_output(args).decode("UTF-8") + # Get date as "Fri Mar 21 07:16:51 2008 -0600" from string + pattern = re.compile('Date:[\t ]*(.*?)$', re.S | re.M) + result = pattern.findall(result)[0] + # Turn "Fri Mar 21 07:16:51 2008 -0600" into "Mar 21 2008 07:16:51 -0600" + pattern = re.compile('^[^ ]* ([^ ]*) ([0-9]*) ([0-9:]*) ([0-9]*) ') + result = pattern.sub('\\1 \\2 \\4 \\3 ', result) + # Use GNU date to compute the time in GMT + args = ['date', '-d', result, '-u', '+%Y-%m-%d %H:%M:%S'] + proc = sp.check_output(args) + result = string(proc, "UTF-8") + result = result.rstrip(os.linesep) + return(result) + + def usage(self): + '''Show help message.''' + result = '''\ Usage: gnulib-tool --list gnulib-tool --find filename gnulib-tool --import [module1 ... moduleN] @@ -287,16 +287,15 @@ Options for --import, --add/remove-import, --update: don't replace copyright notices. Report bugs to <bug-gnulib@gnu.org>.''' - return(result) - - def version(self): - '''Return formatted string which contains git or CVS version.''' - if isdir(DIRS['git']): - version_gen = joinpath(DIRS['build-aux'], 'git-version-gen') - args = [version_gen, DIRS['root']] - result = sp.check_output(args).decode("UTF-8") - result = result.strip() - if result == 'UNKNOWN': - result = string() - return(result) + return(result) + def version(self): + '''Return formatted string which contains git or CVS version.''' + if isdir(DIRS['git']): + version_gen = joinpath(DIRS['build-aux'], 'git-version-gen') + args = [version_gen, DIRS['root']] + result = sp.check_output(args).decode("UTF-8") + result = result.strip() + if result == 'UNKNOWN': + result = string() + return(result) |