Hello community,

here is the log from the commit of package googler for openSUSE:Factory checked 
in at 2019-06-03 18:50:58
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/googler (Old)
 and      /work/SRC/openSUSE:Factory/.googler.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "googler"

Mon Jun  3 18:50:58 2019 rev:4 rq:706895 version:3.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/googler/googler.changes  2019-04-01 
12:37:28.865889104 +0200
+++ /work/SRC/openSUSE:Factory/.googler.new.5148/googler.changes        
2019-06-03 18:50:59.580524342 +0200
@@ -1,0 +2,11 @@
+Thu May 30 03:50:45 UTC 2019 - Dilawar Singh <[email protected]>
+
+- Update to version 3.9
+    * fix issue - googler showing "No results."
+    * show matched keywords in bold in result abstracts
+    * option --colorize for more control on colors
+    * better support for colors on Windows
+    * switch to CircleCI from Travis
+    * option --noua is deprecated (noop) and will be removed in future
+
+-------------------------------------------------------------------

Old:
----
  v3.8.tar.gz

New:
----
  v3.9.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ googler.spec ++++++
--- /var/tmp/diff_new_pack.bi0sX3/_old  2019-06-03 18:51:00.376524069 +0200
+++ /var/tmp/diff_new_pack.bi0sX3/_new  2019-06-03 18:51:00.380524068 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package googler
 #
-# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -12,15 +12,15 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via http://bugs.opensuse.org/
+# Please submit bugfixes or comments via https://bugs.opensuse.org/
 #
 
 
 Name:           googler
-Version:        3.8
+Version:        3.9
 Release:        0
 Summary:        Google Search, Google Site Search, Google News from the 
terminal
-License:        GPL-3.0+
+License:        GPL-3.0-or-later
 Group:          Productivity/Networking/Web/Utilities
 Url:            https://github.com/jarun/googler
 Source:         https://github.com/jarun/googler/archive/v%{version}.tar.gz

++++++ v3.8.tar.gz -> v3.9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/.circleci/config.yml 
new/googler-3.9/.circleci/config.yml
--- old/googler-3.8/.circleci/config.yml        1970-01-01 01:00:00.000000000 
+0100
+++ new/googler-3.9/.circleci/config.yml        2019-05-30 05:07:26.000000000 
+0200
@@ -0,0 +1,79 @@
+version: 2
+
+test-template: &test-template
+  working_directory: ~/googler
+  environment:
+    NUM_TEST_ITERATIONS: 30
+    SLEEP_DURATION: 3
+  steps:
+    - run: apt update && apt install -y --no-install-recommends git wamerican
+    - checkout
+    - run: ./tests/test --ci
+
+jobs:
+  py34:
+    docker:
+      - image: python:3.4-slim
+    <<: *test-template
+
+  py35:
+    docker:
+      - image: python:3.5-slim
+    <<: *test-template
+
+  py36:
+    docker:
+      - image: python:3.6-slim
+    <<: *test-template
+
+  py37:
+    docker:
+      - image: python:3.7-slim
+    <<: *test-template
+
+  package-and-publish:
+    machine: true
+    working_directory: ~/googler
+    steps:
+      - checkout
+      - run:
+          name: "package with packagecore"
+          command: |
+            # Use latest installed python3 from pyenv
+            export PYENV_VERSION="$(pyenv versions | grep -Po '\b3\.\d+\.\d+' 
| tail -1)"
+            pip install packagecore
+            packagecore -o ./dist/ ${CIRCLE_TAG#v}
+      - run:
+          name: "publish to GitHub"
+          command: |
+            go get github.com/tcnksm/ghr
+            ghr -t ${GITHUB_API_TOKEN} -u ${CIRCLE_PROJECT_USERNAME} -r 
${CIRCLE_PROJECT_REPONAME} -c ${CIRCLE_SHA1} -replace ${CIRCLE_TAG} ./dist/
+
+workflows:
+  version: 2
+
+  test:
+    jobs: &all-tests
+      - py34
+      - py35
+      - py36
+      - py37
+
+  weekly:
+    triggers:
+      - schedule:
+          cron: "0 0 * * 6"
+          filters:
+            branches:
+              only:
+                - master
+    jobs: *all-tests
+
+  publish-github-release:
+    jobs:
+      - package-and-publish:
+          filters:
+            tags:
+              only: /^v.*/
+            branches:
+              ignore: /.*/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/.travis.yml new/googler-3.9/.travis.yml
--- old/googler-3.8/.travis.yml 2019-03-27 16:06:06.000000000 +0100
+++ new/googler-3.9/.travis.yml 1970-01-01 01:00:00.000000000 +0100
@@ -1,31 +0,0 @@
-language: python
-python:
-  - "3.4"
-  - "3.5"
-  - "3.6"
-sudo: required
-services:
-  - docker
-dist: trusty
-before_install:
-  - "pip install --upgrade setuptools"
-  - "pip install --upgrade pip"
-script:
-  - ./tests/ci-test-wrapper --watch .travis.yml
-before_deploy:
-  - sudo apt-get update -qy
-  - sudo apt-get install -qy python3 python3-pip
-  - python3 -m pip install packagecore
-  - packagecore -o dist/ "${TRAVIS_TAG#v}"
-deploy:
-  provider: releases
-  api_key:
-    secure: 
g00YmDCb9gszABGJfzTyWeSy6zvvHCRI+vVjvJV7ubgs7L3JUeXfIfLeHZ4fUCX6RjhsOMwgQIIJVVtK5kgUI9YkBRJWdVo7jmJRefkxwTu2SF5SwDjYumiE6mqQlGCfo7OcV0/a/T5ipt5JyBUtY7DIMB2/wyz3jLPCvx4/aQo6COw0tKzaXgiXm0eJz6biEkc3QwGkFUNJFKgmvuvi+FYBJU21fD4cto8ck9i/0IUjsGxbExSpMKbe8bKj3BVh4dyMvZ6e+I/y2l2MM/RazssgFpiqabBm61CL4XCKxXzBsOgjhHSts7y+oWD3YnQqeaeugO5c6d8NPF5LSQk6VYEWYNwt3tdov/6zMMJohyN975AncjtwISzFzBZhAcXUeFxzs+6lfdNZc5lCE9gl+G9gUjWQ/0xyEFtT3m3kyjLlofoqiLwGv/+liaFSSxUpQd2ZHu5OoRjHcCJlxDd+9ppFDjV267zaa4eVBut87PP0QamUWSHEQW4tIuWLujCgJOn+IAMJTppNJ06q5RShV3ilbwlL+SkDSRUS79bLn5ELEgFADTJtUZwLU33VsYgTJ2Ktauu27kvjGitVTR+MgRzc2MVY1Gm6wN8AIe1HQj9YV0ePFp656Q8W29UnuN3QAfPwi2o5SimkNTrtp3MtQhq2nCBB5WqDv5L+DEwj654=
-  file_glob: true
-  file:
-    - dist/*
-  skip_cleanup: true
-  on:
-    tags: true
-    repo: jarun/googler
-    python: "3.6"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/CHANGELOG new/googler-3.9/CHANGELOG
--- old/googler-3.8/CHANGELOG   2019-03-27 16:06:06.000000000 +0100
+++ new/googler-3.9/CHANGELOG   2019-05-30 05:07:26.000000000 +0200
@@ -1,3 +1,16 @@
+googler 3.9
+2019-05-30
+
+What's in?
+- fix issue - `googler` showing "No results."
+- show matched keywords in bold in result abstracts
+- option `--colorize` for more control on colors
+- better support for colors on Windows
+- switch to CircleCI from Travis
+- option `--noua` is deprecated (noop) and will be removed in future
+
+-------------------------------------------------------------------------------
+
 googler 3.8
 2019-03-27
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/README.md new/googler-3.9/README.md
--- old/googler-3.8/README.md   2019-03-27 16:06:06.000000000 +0100
+++ new/googler-3.9/README.md   2019-05-30 05:07:26.000000000 +0200
@@ -13,7 +13,7 @@
 <p align="center">
 <a href="https://repology.org/metapackage/googler";><img 
src="https://repology.org/badge/tiny-repos/googler.svg"; alt="Availability"></a>
 <a href="https://github.com/jarun/googler/blob/master/LICENSE";><img 
src="https://img.shields.io/badge/license-GPLv3-yellow.svg?maxAge=2592000"; 
alt="License" /></a>
-<a href="https://travis-ci.org/jarun/googler";><img 
src="https://travis-ci.org/jarun/googler.svg?branch=master"; alt="Build Status" 
/></a>
+<a href="https://circleci.com/gh/jarun/workflows/googler";><img 
src="https://img.shields.io/circleci/project/github/jarun/googler.svg"; 
alt="Build Status" /></a>
 </p>
 
 <p align="center">
@@ -104,7 +104,6 @@
 - [Slackware](http://slackbuilds.org/repository/14.2/network/googler/) 
(`slackpkg install googler`)
 - [Snap Store](https://snapcraft.io/googler) (`snap install googler`)
 - [Ubuntu](https://packages.ubuntu.com/search?keywords=googler&searchon=names) 
(`apt-get install googler`)
-- [Ubuntu PPA](https://launchpad.net/~twodopeshaggy/+archive/ubuntu/jarun/) 
(`apt-get install googler`)
 - [Void 
Linux](https://github.com/void-linux/void-packages/blob/master/srcpkgs/googler/template)
 (`xbps-install -S googler`)
 
 ##### Tips for packagers
@@ -145,7 +144,7 @@
 
 To install the latest stable version, run
 
-    $ sudo curl -o /usr/local/bin/googler 
https://raw.githubusercontent.com/jarun/googler/v3.8/googler && sudo chmod +x 
/usr/local/bin/googler
+    $ sudo curl -o /usr/local/bin/googler 
https://raw.githubusercontent.com/jarun/googler/v3.9/googler && sudo chmod +x 
/usr/local/bin/googler
 
 You could then let googler upgrade itself by running
 
@@ -168,10 +167,11 @@
 #### Cmdline options
 
 ```
-usage: googler [-h] [-s N] [-n N] [-N] [-c TLD] [-l LANG] [-x] [-C]
-               [--colors COLORS] [-j] [-t dN] [-w SITE] [--unfilter]
-               [-p PROXY] [--noua] [--notweak] [--json] [--url-handler UTIL]
-               [--show-browser-logs] [--np] [-u] [--include-git] [-v] [-d]
+usage: googler [-h] [-s N] [-n N] [-N] [-c TLD] [-l LANG] [-x]
+               [--colorize [{auto,always,never}]] [-C] [--colors COLORS] [-j]
+               [-t dN] [-w SITE] [--unfilter] [-p PROXY] [--noua] [--notweak]
+               [--json] [--url-handler UTIL] [--show-browser-logs] [--np] [-u]
+               [--include-git] [-v] [-d]
                [KEYWORD [KEYWORD ...]]
 
 Google from the command-line.
@@ -188,7 +188,12 @@
                         e.g., 'in' for India
   -l LANG, --lang LANG  display in language LANG
   -x, --exact           disable automatic spelling correction
-  -C, --nocolor         disable color output
+  --colorize [{auto,always,never}]
+                        whether to colorize output; defaults to 'auto', which
+                        enables color when stdout is a tty device; using
+                        --colorize without an argument is equivalent to
+                        --colorize=always
+  -C, --nocolor         equivalent to --colorize=never
   --colors COLORS       set output colors (see man page for details)
   -j, --first, --lucky  open the first result in web browser and exit
   -t dN, --time dN      time limit search [h5 (5 hrs), d5 (5 days), w5 (5
@@ -198,7 +203,7 @@
   -p PROXY, --proxy PROXY
                         tunnel traffic through an HTTP proxy; PROXY is of the
                         form [http://][user:password@]proxyhost[:port]
-  --noua                disable user agent
+  --noua                legacy option (no effect)
   --notweak             disable TCP optimizations and forced TLS 1.2
   --json                output in JSON format; implies --noprompt
   --url-handler UTIL    custom script or cli utility to open results
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/googler-3.8/auto-completion/bash/googler-completion.bash 
new/googler-3.9/auto-completion/bash/googler-completion.bash
--- old/googler-3.8/auto-completion/bash/googler-completion.bash        
2019-03-27 16:06:06.000000000 +0100
+++ new/googler-3.9/auto-completion/bash/googler-completion.bash        
2019-05-30 05:07:26.000000000 +0200
@@ -18,6 +18,7 @@
         -c --tld
         -l --lang
         -x --exact
+        --colorize
         -C --nocolor
         --colors
         -j --first --lucky
@@ -25,7 +26,6 @@
         -w --site
         --unfilter
         -p --proxy
-        --noua
         --notweak
         --json
         --url-handler
@@ -41,6 +41,7 @@
         -n --count
         -c --tld
         -l --lang
+        --colorize
         --colors
         -t --time
         -w --site
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/auto-completion/fish/googler.fish 
new/googler-3.9/auto-completion/fish/googler.fish
--- old/googler-3.8/auto-completion/fish/googler.fish   2019-03-27 
16:06:06.000000000 +0100
+++ new/googler-3.9/auto-completion/fish/googler.fish   2019-05-30 
05:07:26.000000000 +0200
@@ -20,6 +20,7 @@
 complete -c googler -s c -l tld    -r         --description 'country-specific 
search with top-level domain'
 complete -c googler -s l -l lang   -r         --description 'display in 
specified language'
 complete -c googler -s x -l exact             --description 'disable automatic 
spelling correction'
+complete -c googler -l colorize    -r         --description 'whether to 
colorize output (options: auto/always/never)'
 complete -c googler -s C -l nocolor           --description 'disable color 
output'
 complete -c googler -l colors      -r         --description 'set output colors'
 complete -c googler -s j -l first -l lucky    --description 'open the first 
result in a web browser'
@@ -27,7 +28,6 @@
 complete -c googler -s w -l site   -r         --description 'search a site 
using Google'
 complete -c googler -l unfilter               --description 'do not omit 
similar results'
 complete -c googler -s p -l proxy  -r         --description 'proxy in 
HOST:PORT format'
-complete -c googler -l noua                   --description 'disable user 
agent'
 complete -c googler -l notweak                --description 'disable TCP 
optimizations, forced TLS 1.2'
 complete -c googler -l json                   --description 'output in JSON 
format'
 complete -c googler -l url-handler -r         --description 'cli script or 
utility'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/auto-completion/zsh/_googler 
new/googler-3.9/auto-completion/zsh/_googler
--- old/googler-3.8/auto-completion/zsh/_googler        2019-03-27 
16:06:06.000000000 +0100
+++ new/googler-3.9/auto-completion/zsh/_googler        2019-05-30 
05:07:26.000000000 +0200
@@ -41,6 +41,7 @@
     '(-c --tld)'{-c,--tld}'[country-specific search with top-level domain]:top 
level domain without dot'
     '(-l --lang)'{-l,--lang}'[display in specified language]:language code'
     '(-x --exact)'{-x,--exact}'[disable automatic spelling correction]'
+    '(--colorize)--colorize[whether to colorize output]:auto/always/never'
     '(-C --nocolor)'{-C,--nocolor}'[disable color output]'
     '(--colors)--colors[set output colors]:six-letter string'
     '(-j --first --lucky)'{-j,--first,--lucky}'[open the first result in a web 
browser]'
@@ -48,7 +49,6 @@
     '(-w --site)'{-w,--site}'[search a site using Google]:domain'
     '(--unfilter)--unfilter[do not omit similar results]'
     '(-p --proxy)'{-p,--proxy}'[proxy in HOST:PORT format]:proxy details'
-    '(--noua)--noua[disable user agent]'
     '(--notweak)--notweak[disable TCP optimizations, forced TLS 1.2]'
     '(--json)--json[output in JSON format; implies --exact and --noprompt]'
     '(--url-handler)--url-handler[cli script or utility]:url opener'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/googler new/googler-3.9/googler
--- old/googler-3.8/googler     2019-03-27 16:06:06.000000000 +0100
+++ new/googler-3.9/googler     2019-05-30 05:07:26.000000000 +0200
@@ -30,6 +30,7 @@
 import locale
 import logging
 import os
+import platform
 import shutil
 import signal
 import socket
@@ -73,7 +74,7 @@
 
 # Constants
 
-_VERSION_ = '3.8'
+_VERSION_ = '3.9'
 
 COLORMAP = {k: '\x1b[%sm' % v for k, v in {
     'a': '30', 'b': '31', 'c': '32', 'd': '33',
@@ -87,8 +88,7 @@
     'x': '0', 'X': '1', 'y': '7', 'Y': '7;1',
 }.items()}
 
-USER_AGENT = ('googler/' + _VERSION_)
-ua = True  # User Agent is enabled by default
+USER_AGENT = 'googler/%s (like MSIE)' % _VERSION_
 
 text_browsers = ['elinks', 'links', 'lynx', 'w3m', 'www-browser']
 
@@ -1988,7 +1988,17 @@
             if resp.status in {301, 302, 303, 307, 308}:
                 redirection_url = resp.getheader('location', '')
                 if 'sorry/IndexRedirect?' in redirection_url or 'sorry/index?' 
in redirection_url:
-                    raise GoogleConnectionError('Connection blocked due to 
unusual activity.')
+                    msg = textwrap.dedent("""\
+                    Connection blocked due to unusual activity.
+                    THIS IS NOT A BUG, please do NOT report it as a bug unless 
you have specific
+                    information that may lead to the development of a 
workaround.
+                    You IP address is temporarily or permanently blocked by 
Google and requires
+                    reCAPTCHA-solving to use the service, which googler is not 
capable of.
+                    Possible causes include issuing too many queries in a 
short time frame, or
+                    operating from a shared / low reputation IP with a history 
of abuse.
+                    Please do NOT use googler for automated scraping.""")
+                    msg = " ".join(msg.splitlines())
+                    raise GoogleConnectionError(msg)
                 self._redirect(redirection_url)
                 resp = self._resp
                 redirect_counter += 1
@@ -2056,7 +2066,7 @@
         self._conn.request('GET', url, None, {
             'Accept': 'text/html',
             'Accept-Encoding': 'gzip',
-            'User-Agent': USER_AGENT if ua else '',
+            'User-Agent': USER_AGENT,
             'Cookie': self.cookie,
             'Connection': 'keep-alive',
             'DNT': '1',
@@ -2111,7 +2121,12 @@
                 if mime:
                     title = mime.text + ' ' + title
                 url = self.unwrap_link(a.attr('href'))
-                abstract = div_g.select('.st').text.replace('\n', '')
+                matched_keywords = []
+                abstract = ''
+                for childnode in div_g.select('.st').children:
+                    if childnode.tag == 'b' and childnode.text != '...':
+                            matched_keywords.append({'phrase': childnode.text, 
'offset': len(abstract)})
+                    abstract = abstract + childnode.text.replace('\n', '')
                 try:
                     metadata = div_g.select('.slp').text
                     metadata = metadata.replace('\u200e', '').replace(' - ', 
', ').strip()
@@ -2131,7 +2146,7 @@
                     continue
             index += 1
             self.results.append(Result(index, title, url, abstract,
-                                       metadata=metadata, sitelinks=sitelinks))
+                                       metadata=metadata, sitelinks=sitelinks, 
matches=matched_keywords))
 
         # Showing results for ...
         # Search instead for ...
@@ -2211,6 +2226,7 @@
     abstract : str
     metadata : str or None
     sitelinks : list
+    matches : list
 
     Class Variables
     ---------------
@@ -2228,7 +2244,7 @@
     colors = None
     urlexpand = True
 
-    def __init__(self, index, title, url, abstract, metadata=None, 
sitelinks=None):
+    def __init__(self, index, title, url, abstract, metadata=None, 
sitelinks=None, matches=None):
         index = str(index)
         self.index = index
         self.title = title
@@ -2236,6 +2252,7 @@
         self.abstract = abstract
         self.metadata = metadata
         self.sitelinks = [] if sitelinks is None else sitelinks
+        self.matches = [] if matches is None else matches
 
         self._urltable = {index: url}
         subindex = 'a'
@@ -2266,7 +2283,7 @@
             else:
                 print(' %s%-*s %s %s' % (' ' * pre, indent, index + '.', 
title, url))
 
-    def _print_metadata_and_abstract(self, abstract, metadata=None, indent=5, 
pre=0):
+    def _print_metadata_and_abstract(self, abstract, metadata=None, 
matches=None, indent=5, pre=0):
         colors = self.colors
         try:
             columns, _ = os.get_terminal_size()
@@ -2280,6 +2297,15 @@
                 print(' ' * (indent + pre) + metadata)
 
         if colors:
+            # Start from the last match, as inserting the bold characters 
changes the offsets.
+            for match in reversed(matches or []):
+                abstract = (
+                    abstract[: match['offset']]
+                    + '\033[1m'
+                    + match['phrase']
+                    + '\033[0m'
+                    + abstract[match['offset'] + len(match['phrase']) :]
+                )
             print(colors.abstract, end='')
         if columns > indent + 1 + pre:
             # Try to fill to columns
@@ -2295,7 +2321,7 @@
     def print(self):
         """Print the result entry."""
         self._print_title_and_url(self.index, self.title, self.url)
-        self._print_metadata_and_abstract(self.abstract, 
metadata=self.metadata)
+        self._print_metadata_and_abstract(self.abstract, 
metadata=self.metadata, matches=self.matches)
 
         for sitelink in self.sitelinks:
             self._print_title_and_url(sitelink.index, sitelink.title, 
sitelink.url, pre=4)
@@ -2312,6 +2338,8 @@
             obj['metadata'] = self.metadata
         if self.sitelinks:
             obj['sitelinks'] = [sitelink.__dict__ for sitelink in 
self.sitelinks]
+        if self.matches:
+            obj['matches'] = self.matches
         return obj
 
     def urltable(self):
@@ -2448,7 +2476,7 @@
 
         if logger.isEnabledFor(logging.DEBUG):
             import tempfile
-            fd, tmpfile = tempfile.mkstemp(prefix='googler-response-')
+            fd, tmpfile = tempfile.mkstemp(prefix='googler-response-', 
suffix='.html')
             os.close(fd)
             with open(tmpfile, 'w', encoding='utf-8') as fp:
                 fp.write(page)
@@ -3046,6 +3074,31 @@
     return user_passwd, host_port
 
 
+def set_win_console_mode():
+    # VT100 control sequences are supported on Windows 10 Anniversary Update 
and later.
+    # 
https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
+    # https://docs.microsoft.com/en-us/windows/console/setconsolemode
+    if platform.release() == '10':
+        STD_OUTPUT_HANDLE = -11
+        STD_ERROR_HANDLE = -12
+        ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004
+        try:
+            from ctypes import windll, wintypes, byref
+            kernel32 = windll.kernel32
+            for nhandle in (STD_OUTPUT_HANDLE, STD_ERROR_HANDLE):
+                handle = kernel32.GetStdHandle(nhandle)
+                old_mode = wintypes.DWORD()
+                if not kernel32.GetConsoleMode(handle, byref(old_mode)):
+                    raise RuntimeError('GetConsoleMode failed')
+                new_mode = old_mode.value | ENABLE_VIRTUAL_TERMINAL_PROCESSING
+                if not kernel32.SetConsoleMode(handle, new_mode):
+                    raise RuntimeError('SetConsoleMode failed')
+            # Note: No need to restore at exit. SetConsoleMode seems to
+            # be limited to the calling process.
+        except Exception:
+            pass
+
+
 # Query autocompleter
 
 # This function is largely experimental and could raise any exception;
@@ -3126,8 +3179,13 @@
     addarg('-l', '--lang', metavar='LANG', help='display in language LANG')
     addarg('-x', '--exact', action='store_true',
            help='disable automatic spelling correction')
-    addarg('-C', '--nocolor', dest='colorize', action='store_false',
-           help='disable color output')
+    addarg('--colorize', nargs='?', choices=['auto', 'always', 'never'],
+           const='always', default='auto',
+           help="""whether to colorize output; defaults to 'auto', which 
enables
+           color when stdout is a tty device; using --colorize without an 
argument
+           is equivalent to --colorize=always""")
+    addarg('-C', '--nocolor', action='store_true',
+           help='equivalent to --colorize=never')
     addarg('--colors', dest='colorstr', type=argparser.is_colorstr,
            default=colorstr_env if colorstr_env else 'GKlgxy', 
metavar='COLORS',
            help='set output colors (see man page for details)')
@@ -3142,7 +3200,7 @@
     addarg('-p', '--proxy', default=https_proxy_from_environment(),
            help="""tunnel traffic through an HTTP proxy;
            PROXY is of the form [http://][user:password@]proxyhost[:port]""";)
-    addarg('--noua', action='store_true', help='disable user agent')
+    addarg('--noua', action='store_true', help='legacy option (no effect)')
     addarg('--notweak', action='store_true',
            help='disable TCP optimizations and forced TLS 1.2')
     addarg('--json', action='store_true',
@@ -3165,12 +3223,14 @@
     addarg('-D', '--debugger', action='store_true', help=argparse.SUPPRESS)
     addarg('--complete', help=argparse.SUPPRESS)
 
-    return argparser.parse_args(args, namespace)
+    parsed = argparser.parse_args(args, namespace)
+    if parsed.nocolor:
+        parsed.colorize = 'never'
 
+    return parsed
 
-def main():
-    global ua
 
+def main():
     try:
         opts = parse_args()
 
@@ -3203,7 +3263,14 @@
                 pass
 
         # Set colors
-        if opts.colorize:
+        if opts.colorize == 'always':
+            colorize = True
+        elif opts.colorize == 'auto':
+            colorize = sys.stdout.isatty()
+        else:  # opts.colorize == 'never'
+            colorize = False
+
+        if colorize:
             colors = Colors(*[COLORMAP[c] for c in opts.colorstr], 
reset=COLORMAP['x'])
         else:
             colors = None
@@ -3211,6 +3278,10 @@
         Result.urlexpand = True if os.getenv('DISABLE_URL_EXPANSION') is None 
else False
         GooglerCmd.colors = colors
 
+        # Try to enable ANSI color support in cmd or PowerShell on Windows 10
+        if sys.platform == 'win32' and sys.stdout.isatty() and colorize:
+            set_win_console_mode()
+
         if opts.url_handler is not None:
             open_url.url_handler = opts.url_handler
         else:
@@ -3224,8 +3295,7 @@
                 open_url.suppress_browser_output = True
 
         if opts.noua:
-            logger.debug('User Agent is disabled')
-            ua = False
+            logger.warning('--noua option has been deprecated and has no 
effect (see #284)')
 
         repl = GooglerCmd(opts)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/googler.1 new/googler-3.9/googler.1
--- old/googler-3.8/googler.1   2019-03-27 16:06:06.000000000 +0100
+++ new/googler-3.9/googler.1   2019-05-30 05:07:26.000000000 +0200
@@ -1,4 +1,4 @@
-.TH "GOOGLER" "1" "27 Mar 2019" "Version 3.8" "User Commands"
+.TH "GOOGLER" "1" "30 May 2019" "Version 3.9" "User Commands"
 .SH NAME
 googler \- Google from the command-line
 .SH SYNOPSIS
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/packagecore.yaml 
new/googler-3.9/packagecore.yaml
--- old/googler-3.8/packagecore.yaml    2019-03-27 16:06:06.000000000 +0100
+++ new/googler-3.9/packagecore.yaml    2019-05-30 05:07:26.000000000 +0200
@@ -13,23 +13,7 @@
     deps:
       - python
     container: "archlinux/base"
-  centos7.0:
-    builddeps:
-      - make
-    deps:
-      - python
-    commands:
-      pre:
-        - yum install epel-release
-  centos7.1:
-    builddeps:
-      - make
-    deps:
-      - python
-    commands:
-      pre:
-        - yum install epel-release
-  centos7.2:
+  centos7.4:
     builddeps:
       - make
     deps:
@@ -37,15 +21,12 @@
     commands:
       pre:
         - yum install epel-release
-  centos7.3:
+  centos7.5:
     builddeps:
       - make
     deps:
       - python
-    commands:
-      pre:
-        - yum install epel-release
-  centos7.4:
+  centos7.6:
     builddeps:
       - make
     deps:
@@ -85,16 +66,11 @@
       - make
     deps:
       - python3
-#  opensuse42.1:
-#    builddeps:
-#      - make
-#    deps:
-#      - python3
-#  opensuse42.2:
-#    builddeps:
-#      - make
-#    deps:
-#      - python3
+  fedora30:
+    builddeps:
+      - make
+    deps:
+      - python3
   opensuse42.3:
     builddeps:
       - make
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/tests/ci-test-wrapper 
new/googler-3.9/tests/ci-test-wrapper
--- old/googler-3.8/tests/ci-test-wrapper       2019-03-27 16:06:06.000000000 
+0100
+++ new/googler-3.9/tests/ci-test-wrapper       1970-01-01 01:00:00.000000000 
+0100
@@ -1,93 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-declare here repo_root test_script
-here="$(perl -e 'use File::Basename; use Cwd "abs_path"; print 
dirname(abs_path(@ARGV[0]));' -- "$0")"
-repo_root="$here/.."
-test_script="$here/test"
-export GIT_DIR="$here/../.git"
-
-declare -a watchlist
-watchlist=(googler tests)
-while [[ $1 == -* ]]; do
-    case $1 in
-        -h|--help)
-            cat <<'EOF'
-Usage: ci-test-wrapper [-h|--help] [--monitor PATH [PATH ...]]
-
-googler(1) testing wrapper for CIs.
-
-Options:
-    -h, --help
-        Print this help and exit.
-    --watch PATH [PATH ...]
-        Additional paths (relative to repository root) to watch. Only run tests
-        when watched paths have been modified. By default only googler and
-        tests/ are watched, but sometimes additional paths should be watched
-        depending on circumstances, e.g., for Travis, .travis.yml should also
-        be watched. Note that this option consumes all of the remaining command
-        line arguments.
-EOF
-            exit 1
-            ;;
-        --watch)
-            shift
-            watchlist=( "${watchlist[@]}" "$@" )
-            shift $#
-            break
-            ;;
-        *)
-            printf '\033[31mError: Unrecognized option %q.\033[0m\n' "$1" >&2
-            exit 1
-            ;;
-    esac
-    shift
-done
-(( $# > 0 )) && {
-    printf '\033[31mError: Unrecognized arguments %s.\033[0m\n' "$*" >&2
-    exit 1
-}
-
-# Abort if the CI_SKIP_TEST environment variable is detected.
-if [[ -n $CI_SKIP_TEST ]]; then
-    printf 'Detected $CI_SKIP_TEST. Skipping tests.' >&2
-    exit
-fi
-
-# Diff HEAD against a base commit to see if the changes are worth
-# testing. (This check is skipped entirely if the CI_FORCE_TEST environment
-# variable is set and non-nil.)
-#
-# * For a regular branch, diff against HEAD^;
-# * For a PR branch, diff against the merge base of HEAD and master.
-#
-# Currently we use $TRAVIS_PULL_REQUEST to determine whether we're building a
-# PR branch. Other criteria may be added if we ever expand to other CIs.
-
-if [[ -z $CI_FORCE_TEST ]]; then
-    printf 'We are watching the following paths:\n' >&2
-    printf '    - %s\n' "${watchlist[@]}" >&2
-    printf '\n' >&2
-
-    declare diff_commits diff
-    if [[ -z ${TRAVIS_PULL_REQUEST+x} || $TRAVIS_PULL_REQUEST == false ]]; then
-        diff_commits='HEAD^..HEAD'
-    else
-        diff_commits='master...HEAD'
-    fi
-    diff=$(git -C "$repo_root" diff "$diff_commits" -- "${watchlist[@]}")
-    if [[ -z $diff ]]; then
-        printf 'None of the watchlist items changed, skipping tests.\n' >&2
-        printf 'You may set the $CI_FORCE_TEST environment variable to force 
testing.\n' >&2
-        exit 0
-    else
-        printf 'Changes to watchlist item(s) detected. Will test.\n\n' >&2
-    fi
-else
-    printf 'Detected $CI_FORCE_TEST. Skipping necessity checks.\n\n' >&2
-fi
-
-# Test googler(1) with $repo_root at the beginning of $PATH (so that googler
-# from this repo is picked up).
-PATH="$repo_root:$PATH" "$test_script" --ci
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/googler-3.8/tests/test new/googler-3.9/tests/test
--- old/googler-3.8/tests/test  2019-03-27 16:06:06.000000000 +0100
+++ new/googler-3.9/tests/test  2019-05-30 05:07:26.000000000 +0200
@@ -2,7 +2,12 @@
 
 set -e
 
-declare quiet exitcode
+trap 'exit 130' INT
+
+declare here googler quiet ci exitcode
+
+here="$(python3 -c 'import pathlib, sys; 
print(pathlib.Path(sys.argv[2]).parent.resolve())' -- "$0")"
+googler=$here/../googler
 
 quiet=0
 ci=0
@@ -17,7 +22,7 @@
             cat <<'EOF'
 Usage: test [options]
 
-Run automated tests of googler(1). googler(1) is expected on $PATH.
+Run automated tests of googler(1).
 
 Requires shuf(1) from coreutils and /usr/share/dict/words.
 
@@ -105,12 +110,12 @@
 
     declare -g quiet
     if (( quiet )); then
-        googler --noprompt -d "$@" &>/dev/null || report_error --rerun "$@"
+        $googler --noprompt -d "$@" &>/dev/null || report_error --rerun "$@"
     else
         printf '\033[34m==> googler ' >&2
         printf '%q ' "$@" >&2
         printf '\033[0m\n' >&2
-        googler --noprompt -d "$@" || report_error "$@"
+        $googler --noprompt -d "$@" || report_error "$@"
         echo
     fi
 }


Reply via email to