Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-gscholar for openSUSE:Factory checked in at 2022-02-04 00:45:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-gscholar (Old) and /work/SRC/openSUSE:Factory/.python-gscholar.new.1898 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-gscholar" Fri Feb 4 00:45:53 2022 rev:3 rq:951390 version:2.0.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-gscholar/python-gscholar.changes 2020-05-28 09:18:17.529095933 +0200 +++ /work/SRC/openSUSE:Factory/.python-gscholar.new.1898/python-gscholar.changes 2022-02-04 00:46:17.321124574 +0100 @@ -1,0 +2,14 @@ +Thu Feb 3 20:18:19 UTC 2022 - Arun Persaud <a...@gmx.de> + +- specfile: + * update copyright year + * skip python2 + +- update to version 2.0.0: + * removed Python2 support + * migrated to pytest + * allow tests to fail that are effected by google's rate limiter + * added github action for tests and dependency updates + * fixed various linter errors + +------------------------------------------------------------------- Old: ---- gscholar-1.6.1.tar.gz New: ---- gscholar-2.0.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-gscholar.spec ++++++ --- /var/tmp/diff_new_pack.SwW1Lw/_old 2022-02-04 00:46:17.961119893 +0100 +++ /var/tmp/diff_new_pack.SwW1Lw/_new 2022-02-04 00:46:17.965119863 +0100 @@ -1,7 +1,7 @@ # # spec file for package python-gscholar # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,20 +17,20 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%define skip_python2 1 Name: python-gscholar -Version: 1.6.1 +Version: 2.0.0 Release: 0 Summary: Python library to query Google Scholar License: MIT Group: Development/Languages/Python URL: https://github.com/venthur/gscholar Source0: https://files.pythonhosted.org/packages/source/g/gscholar/gscholar-%{version}.tar.gz -BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives BuildArch: noarch %python_subpackages @@ -61,7 +61,7 @@ %files %{python_files} %license LICENSE %doc README.md CHANGELOG.md -%{python_sitelib}/* +%{python_sitelib}/gscholar* %python_alternative %{_bindir}/gscholar %changelog ++++++ gscholar-1.6.1.tar.gz -> gscholar-2.0.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/CHANGELOG.md new/gscholar-2.0.0/CHANGELOG.md --- old/gscholar-1.6.1/CHANGELOG.md 2018-02-17 10:53:29.000000000 +0100 +++ new/gscholar-2.0.0/CHANGELOG.md 2021-12-08 13:42:07.000000000 +0100 @@ -1,5 +1,13 @@ # Changelog +## [2.0.0] - 2021-12-08 + +* removed Python2 support +* migrated to pytest +* allow tests to fail that are effected by google's rate limiter +* added github action for tests and dependency updates +* fixed various linter errors + ## [1.6.1] - 2018-02-17 * Include Changelog and LICENSE files in source distribution diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/PKG-INFO new/gscholar-2.0.0/PKG-INFO --- old/gscholar-1.6.1/PKG-INFO 2018-02-17 10:54:27.000000000 +0100 +++ new/gscholar-2.0.0/PKG-INFO 2021-12-08 13:42:21.182349200 +0100 @@ -1,16 +1,110 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: gscholar -Version: 1.6.1 +Version: 2.0.0 Summary: Python library to query Google Scholar. Home-page: https://github.com/venthur/gscholar Author: Bastian Venthur Author-email: m...@venthur.de License: MIT -Description-Content-Type: UNKNOWN -Description: This package provides a python package and CLI to query google scholar and get references in various formats (e.g. bibtex, endnote, etc.) +Project-URL: Source, https://github.com/venthur/gscholar +Project-URL: Changelog, https://github.com/venthur/gscholar/blob/master/CHANGELOG.md +Description: # gscholar + + Query Google Scholar using Python. + + + ## Requirements + + * Python + * pdftotext (command line tool) + + + ### Note on Python2 and Python3 + + Gscholar is Python2 and Python3 compatible. No changes should be required to run + on either Python version. + + + ## Installing + + ```bash + $ pip install gscholar + ``` + + ##Using gscholar as a command line tool + + gscholar provides a command line tool, to use it, just call `gscholar` like: + + ```bash + $ gscholar "albert einstein" + ``` + + or + + ```bash + $ python3 -m gscholar "albert einstein" + ``` + + ### Making a simple lookup: + + ```bash + $ gscholar "some author or title" + ``` + + will return the first result from Google Scholar matching this query. + + + ### Getting more results: + + ```bash + $ gscholar --all "some author or title" + ``` + + Same as above but returns up to 10 bibtex items. (Use with caution Google will + assume you're a bot an ban you're IP temporarily) + + + ### Querying using a pdf: + + ```bash + $ gscholar /path/to/pdf + ``` + + Will read the pdf to generate a Google Scholar query. It uses this query to show + the first bibtex result as above. + + + ### Renaming a pdf: + + ```bash + $ gscholar --rename /path/to/pdf + ``` + + Will do the same as above but asks you if it should rename the file according + to the bibtex result. You have to answer with "y", default answer is no. + + + ### Getting help: + + ```bash + $ gscholar --help + ``` + + + ## Using gscholar as a python library + + Install the gscholar package with `pip install` as described above or copy the + package somewhere Python can find it. + + ```python + import gscholar + + gscholar.query("some author or title") + ``` + + will return a list of bibtex items. + Keywords: google scholar cli Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.6 +Requires-Python: >=3.6 +Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/README.md new/gscholar-2.0.0/README.md --- old/gscholar-1.6.1/README.md 2017-10-14 19:41:47.000000000 +0200 +++ new/gscholar-2.0.0/README.md 2021-12-08 09:23:43.000000000 +0100 @@ -2,8 +2,6 @@ Query Google Scholar using Python. -<a href="https://flattr.com/submit/auto?user_id=venthur&url=http%3A%2F%2Fgithub.com%2Fventhur%2Fgscholar" target="_blank"><img src="http://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" border="0"></a> - ## Requirements @@ -59,7 +57,7 @@ ### Querying using a pdf: ```bash -$ gscolar /path/to/pdf +$ gscholar /path/to/pdf ``` Will read the pdf to generate a Google Scholar query. It uses this query to show diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/gscholar/__init__.py new/gscholar-2.0.0/gscholar/__init__.py --- old/gscholar-1.6.1/gscholar/__init__.py 2018-02-17 10:53:29.000000000 +0100 +++ new/gscholar-2.0.0/gscholar/__init__.py 2021-12-08 13:42:07.000000000 +0100 @@ -1,5 +1,2 @@ -from __future__ import absolute_import - -from gscholar.gscholar import * - -__VERSION__ = '1.6.1' +from gscholar.gscholar import * # noqa +from gscholar.version import __VERSION__ # noqa diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/gscholar/__main__.py new/gscholar-2.0.0/gscholar/__main__.py --- old/gscholar-1.6.1/gscholar/__main__.py 2018-02-17 10:53:29.000000000 +0100 +++ new/gscholar-2.0.0/gscholar/__main__.py 2021-12-08 13:42:07.000000000 +0100 @@ -1,5 +1,3 @@ -#!/usr/bin/env python - import optparse import logging import sys @@ -26,7 +24,9 @@ default=False, help="rename file") parser.add_option("-f", "--outputformat", dest='output', default="bibtex", - help="Output format. Available formats are: bibtex, endnote, refman, wenxianwang [default: %default]") + help=("Output format. Available formats are: bibtex, " + "endnote, refman, wenxianwang " + "[default: %default]")) parser.add_option("-s", "--startpage", dest='startpage', help="Page number to start parsing PDF file at.") parser.add_option('-V', '--version', action='store_true', @@ -52,11 +52,12 @@ args = args[0] pdfmode = False if os.path.exists(args): - logger.debug("File exist, assuming you want me to lookup the pdf: {filename}.".format(filename=args)) + logger.debug(f"File exist, assuming you want me to lookup the pdf: " + f"{args}.") pdfmode = True biblist = gs.pdflookup(args, all, outformat, options.startpage) else: - logger.debug("Assuming you want me to lookup the query: {query}".format(query=args)) + logger.debug(f"Assuming you want me to lookup the query: {args}") biblist = gs.query(args, outformat, options.all) if len(biblist) < 1: print("No results found, try again with a different query!") @@ -70,7 +71,8 @@ print(biblist[0]) if options.rename is True: if not pdfmode: - print("You asked me to rename the pdf but didn't tell me which file to rename, aborting.") + print("You asked me to rename the pdf but didn't tell me which " + "file to rename, aborting.") sys.exit(1) else: gs.rename_file(args, biblist[0]) @@ -78,5 +80,3 @@ if __name__ == '__main__': main() - -# vim: set filetype=python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/gscholar/gscholar.py new/gscholar-2.0.0/gscholar/gscholar.py --- old/gscholar-1.6.1/gscholar/gscholar.py 2018-01-21 15:53:10.000000000 +0100 +++ new/gscholar-2.0.0/gscholar/gscholar.py 2021-12-08 13:42:07.000000000 +0100 @@ -8,20 +8,8 @@ """ -try: - # python 2 - from urllib2 import Request, urlopen, quote -except ImportError: - # python 3 - from urllib.request import Request, urlopen, quote - -try: - # python 2 - from htmlentitydefs import name2codepoint -except ImportError: - # python 3 - from html.entities import name2codepoint - +from urllib.request import Request, urlopen, quote +from html.entities import name2codepoint import re import os import subprocess @@ -101,14 +89,15 @@ the links to the references """ + base_url = 'https://scholar.googleusercontent.com' if outformat == FORMAT_BIBTEX: - refre = re.compile(r'<a href="https://scholar.googleusercontent.com(/scholar\.bib\?[^"]*)') + refre = re.compile(fr'<a href="{base_url}(/scholar\.bib\?[^"]*)') elif outformat == FORMAT_ENDNOTE: - refre = re.compile(r'<a href="https://scholar.googleusercontent.com(/scholar\.enw\?[^"]*)"') + refre = re.compile(fr'<a href="{base_url}(/scholar\.enw\?[^"]*)"') elif outformat == FORMAT_REFMAN: - refre = re.compile(r'<a href="https://scholar.googleusercontent.com(/scholar\.ris\?[^"]*)"') + refre = re.compile(fr'<a href="{base_url}(/scholar\.ris\?[^"]*)"') elif outformat == FORMAT_WENXIANWANG: - refre = re.compile(r'<a href="https://scholar.googleusercontent.com(/scholar\.ral\?[^"]*)"') + refre = re.compile(fr'<a href="{base_url}(/scholar\.ral\?[^"]*)"') reflist = refre.findall(html) # escape html entities reflist = [re.sub('&(%s);' % '|'.join(name2codepoint), lambda m: @@ -168,7 +157,7 @@ """ txt = convert_pdf_to_txt(pdf, startpage) # remove all non alphanumeric characters - txt = re.sub("\W", " ", txt) + txt = re.sub(r"\W", " ", txt) words = txt.strip().split()[:20] gsquery = " ".join(words) bibtexlist = query(gsquery, outformat, allresults) @@ -209,8 +198,8 @@ if author: author = author.split(",")[0] title = _get_bib_element(bibitem, "title") - l = [i for i in (year, author, title) if i] - filename = "-".join(l) + ".pdf" + elem = [i for i in (year, author, title) if i] + filename = "-".join(elem) + ".pdf" newfile = pdf.replace(os.path.basename(pdf), filename) logger.info('Renaming {in_} to {out}'.format(in_=pdf, out=newfile)) os.rename(pdf, newfile) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/gscholar/version.py new/gscholar-2.0.0/gscholar/version.py --- old/gscholar-1.6.1/gscholar/version.py 1970-01-01 01:00:00.000000000 +0100 +++ new/gscholar-2.0.0/gscholar/version.py 2021-12-08 13:42:07.000000000 +0100 @@ -0,0 +1 @@ +__VERSION__ = '2.0.0' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/gscholar.egg-info/PKG-INFO new/gscholar-2.0.0/gscholar.egg-info/PKG-INFO --- old/gscholar-1.6.1/gscholar.egg-info/PKG-INFO 2018-02-17 10:54:27.000000000 +0100 +++ new/gscholar-2.0.0/gscholar.egg-info/PKG-INFO 2021-12-08 13:42:21.000000000 +0100 @@ -1,16 +1,110 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: gscholar -Version: 1.6.1 +Version: 2.0.0 Summary: Python library to query Google Scholar. Home-page: https://github.com/venthur/gscholar Author: Bastian Venthur Author-email: m...@venthur.de License: MIT -Description-Content-Type: UNKNOWN -Description: This package provides a python package and CLI to query google scholar and get references in various formats (e.g. bibtex, endnote, etc.) +Project-URL: Source, https://github.com/venthur/gscholar +Project-URL: Changelog, https://github.com/venthur/gscholar/blob/master/CHANGELOG.md +Description: # gscholar + + Query Google Scholar using Python. + + + ## Requirements + + * Python + * pdftotext (command line tool) + + + ### Note on Python2 and Python3 + + Gscholar is Python2 and Python3 compatible. No changes should be required to run + on either Python version. + + + ## Installing + + ```bash + $ pip install gscholar + ``` + + ##Using gscholar as a command line tool + + gscholar provides a command line tool, to use it, just call `gscholar` like: + + ```bash + $ gscholar "albert einstein" + ``` + + or + + ```bash + $ python3 -m gscholar "albert einstein" + ``` + + ### Making a simple lookup: + + ```bash + $ gscholar "some author or title" + ``` + + will return the first result from Google Scholar matching this query. + + + ### Getting more results: + + ```bash + $ gscholar --all "some author or title" + ``` + + Same as above but returns up to 10 bibtex items. (Use with caution Google will + assume you're a bot an ban you're IP temporarily) + + + ### Querying using a pdf: + + ```bash + $ gscholar /path/to/pdf + ``` + + Will read the pdf to generate a Google Scholar query. It uses this query to show + the first bibtex result as above. + + + ### Renaming a pdf: + + ```bash + $ gscholar --rename /path/to/pdf + ``` + + Will do the same as above but asks you if it should rename the file according + to the bibtex result. You have to answer with "y", default answer is no. + + + ### Getting help: + + ```bash + $ gscholar --help + ``` + + + ## Using gscholar as a python library + + Install the gscholar package with `pip install` as described above or copy the + package somewhere Python can find it. + + ```python + import gscholar + + gscholar.query("some author or title") + ``` + + will return a list of bibtex items. + Keywords: google scholar cli Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: License :: OSI Approved :: MIT License -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.6 +Requires-Python: >=3.6 +Description-Content-Type: text/markdown diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/gscholar.egg-info/SOURCES.txt new/gscholar-2.0.0/gscholar.egg-info/SOURCES.txt --- old/gscholar-1.6.1/gscholar.egg-info/SOURCES.txt 2018-02-17 10:54:27.000000000 +0100 +++ new/gscholar-2.0.0/gscholar.egg-info/SOURCES.txt 2021-12-08 13:42:21.000000000 +0100 @@ -2,13 +2,14 @@ LICENSE MANIFEST.in README.md +setup.cfg setup.py gscholar/__init__.py gscholar/__main__.py gscholar/gscholar.py +gscholar/version.py gscholar.egg-info/PKG-INFO gscholar.egg-info/SOURCES.txt gscholar.egg-info/dependency_links.txt gscholar.egg-info/entry_points.txt -gscholar.egg-info/top_level.txt -test/test_gscholar.py \ No newline at end of file +gscholar.egg-info/top_level.txt \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/setup.cfg new/gscholar-2.0.0/setup.cfg --- old/gscholar-1.6.1/setup.cfg 2018-02-17 10:54:27.000000000 +0100 +++ new/gscholar-2.0.0/setup.cfg 2021-12-08 13:42:21.182349200 +0100 @@ -1,3 +1,13 @@ +[tool:pytest] +addopts = + --cov=gscholar + --cov=tests + --cov-report=html + --cov-report=term-missing:skip-covered + +[flake8] +exclude = venv,build,docs + [egg_info] tag_build = tag_date = 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/setup.py new/gscholar-2.0.0/setup.py --- old/gscholar-1.6.1/setup.py 2017-10-14 19:23:26.000000000 +0200 +++ new/gscholar-2.0.0/setup.py 2021-12-08 13:42:07.000000000 +0100 @@ -3,27 +3,33 @@ from setuptools import setup -import gscholar -setup(name='gscholar', - version=gscholar.__VERSION__, - description='Python library to query Google Scholar.', - long_description='This package provides a python package and CLI to query google scholar and get references in various formats (e.g. bibtex, endnote, etc.)', - classifiers=[ - 'Development Status :: 5 - Production/Stable', - 'License :: OSI Approved :: MIT License', - 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.6', - ], - keywords='google scholar cli', - author='Bastian Venthur', - author_email='m...@venthur.de', - url='https://github.com/venthur/gscholar', - packages=['gscholar'], - entry_points={ - 'console_scripts': [ - 'gscholar = gscholar.__main__:main' - ] - }, - license='MIT', +meta = {} +exec(open('./gscholar/version.py').read(), meta) +meta['long_description'] = open('./README.md').read() + + +setup( + name='gscholar', + version=meta["__VERSION__"], + description='Python library to query Google Scholar.', + long_description=meta['long_description'], + long_description_content_type='text/markdown', + keywords='google scholar cli', + author='Bastian Venthur', + author_email='m...@venthur.de', + url='https://github.com/venthur/gscholar', + project_urls={ + 'Source': 'https://github.com/venthur/gscholar', + 'Changelog': + 'https://github.com/venthur/gscholar/blob/master/CHANGELOG.md', + }, + python_requires='>=3.6', + packages=['gscholar'], + entry_points={ + 'console_scripts': [ + 'gscholar = gscholar.__main__:main' + ] + }, + license='MIT', ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gscholar-1.6.1/test/test_gscholar.py new/gscholar-2.0.0/test/test_gscholar.py --- old/gscholar-1.6.1/test/test_gscholar.py 2014-10-15 09:28:20.000000000 +0200 +++ new/gscholar-2.0.0/test/test_gscholar.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,31 +0,0 @@ -#!/usr/bin/env python -# coding: utf8 - -import unittest -import time -import random - -from gscholar import gscholar as gs - - -class TestGScholar(unittest.TestCase): - - def tearDown(self): - # wait 1-2 seconds between tests, so we don't hammer google's - # servers and get banned. - time.sleep(random.uniform(1, 2)) - - def test_query(self): - """Normal query with latin encoding should give non empty result.""" - result = gs.query('Albert Einstein', gs.FORMAT_BIBTEX) - self.assertTrue(result) - - def test_query_utf8(self): - """Normal query with utf8 encoding should give non empty result.""" - result = gs.query("Anders Jonas ??ngstr??m", gs.FORMAT_BIBTEX) - self.assertTrue(result) - - -if __name__ == '__main__': - unittest.main() -