Hello community,
here is the log from the commit of package python-userpath for openSUSE:Factory
checked in at 2020-07-24 10:06:30
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-userpath (Old)
and /work/SRC/openSUSE:Factory/.python-userpath.new.3592 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-userpath"
Fri Jul 24 10:06:30 2020 rev:3 rq:822369 version:1.4.1
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-userpath/python-userpath.changes
2020-05-19 14:48:14.988040272 +0200
+++
/work/SRC/openSUSE:Factory/.python-userpath.new.3592/python-userpath.changes
2020-07-24 10:07:35.322027589 +0200
@@ -1,0 +2,7 @@
+Thu Jul 23 11:07:58 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- update to 1.4.1
+ * Prevent adding paths multiple times on macOS/Linux
+ * Send CLI errors to stderr instead of stdout
+
+-------------------------------------------------------------------
Old:
----
userpath-1.3.0.tar.gz
New:
----
userpath-1.4.1.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-userpath.spec ++++++
--- /var/tmp/diff_new_pack.4EQLVY/_old 2020-07-24 10:07:40.946033228 +0200
+++ /var/tmp/diff_new_pack.4EQLVY/_new 2020-07-24 10:07:40.950033231 +0200
@@ -18,7 +18,7 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-userpath
-Version: 1.3.0
+Version: 1.4.1
Release: 0
Summary: Tool for adding locations to the user PATH
License: MIT OR Apache-2.0
++++++ userpath-1.3.0.tar.gz -> userpath-1.4.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/userpath-1.3.0/PKG-INFO new/userpath-1.4.1/PKG-INFO
--- old/userpath-1.3.0/PKG-INFO 2019-10-20 15:37:22.000000000 +0200
+++ new/userpath-1.4.1/PKG-INFO 2020-06-25 18:19:01.448213800 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: userpath
-Version: 1.3.0
+Version: 1.4.1
Summary: Cross-platform tool for adding locations to the user PATH, no
elevated privileges required!
Home-page: https://github.com/ofek/userpath
Author: Ofek Lev
@@ -124,6 +124,13 @@
Important changes are emphasized.
+ 1.4.0
+ ^^^^^
+
+ - Fix duplicating system paths on Windows
+ - Prevent adding paths multiple times on macOS/Linux
+ - Send CLI errors to stderr instead of stdout
+
1.3.0
^^^^^
@@ -153,5 +160,7 @@
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/userpath-1.3.0/README.rst
new/userpath-1.4.1/README.rst
--- old/userpath-1.3.0/README.rst 2019-10-20 07:03:42.000000000 +0200
+++ new/userpath-1.4.1/README.rst 2020-05-09 16:59:33.000000000 +0200
@@ -114,6 +114,13 @@
Important changes are emphasized.
+1.4.0
+^^^^^
+
+- Fix duplicating system paths on Windows
+- Prevent adding paths multiple times on macOS/Linux
+- Send CLI errors to stderr instead of stdout
+
1.3.0
^^^^^
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/userpath-1.3.0/setup.py new/userpath-1.4.1/setup.py
--- old/userpath-1.3.0/setup.py 2019-10-20 05:42:51.000000000 +0200
+++ new/userpath-1.4.1/setup.py 2020-06-25 18:15:19.000000000 +0200
@@ -44,6 +44,8 @@
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
+ 'Programming Language :: Python :: 3.8',
+ 'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/userpath-1.3.0/tests/test_bash.py
new/userpath-1.4.1/tests/test_bash.py
--- old/userpath-1.3.0/tests/test_bash.py 2019-05-28 05:56:06.000000000
+0200
+++ new/userpath-1.4.1/tests/test_bash.py 2020-05-09 14:49:01.000000000
+0200
@@ -38,6 +38,22 @@
assert process.returncode == 0, (stdout + stderr).decode('utf-8')
+ def test_prepend_twice(self, request, shell_test):
+ if shell_test is None:
+ location = get_random_path()
+ assert not userpath.in_current_path(location)
+ assert userpath.prepend(location, check=True)
+ assert userpath.in_new_path(location)
+ assert userpath.need_shell_restart(location)
+
+ assert userpath.prepend(location, check=True)
+ else:
+ process = shell_test(request.node.name)
+ stdout, stderr = process.communicate()
+
+ assert process.returncode == 0, (stdout + stderr).decode('utf-8')
+
+
def test_append(self, request, shell_test):
if shell_test is None:
location = get_random_path()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/userpath-1.3.0/userpath/__init__.py
new/userpath-1.4.1/userpath/__init__.py
--- old/userpath-1.3.0/userpath/__init__.py 2019-10-20 15:35:43.000000000
+0200
+++ new/userpath-1.4.1/userpath/__init__.py 2020-06-25 18:14:38.000000000
+0200
@@ -1,4 +1,4 @@
from .core import append, in_new_path, need_shell_restart, prepend
from .utils import in_current_path
-__version__ = '1.3.0'
+__version__ = '1.4.1'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/userpath-1.3.0/userpath/cli.py
new/userpath-1.4.1/userpath/cli.py
--- old/userpath-1.3.0/userpath/cli.py 2019-07-13 19:28:37.000000000 +0200
+++ new/userpath-1.4.1/userpath/cli.py 2020-05-09 16:01:45.000000000 +0200
@@ -14,7 +14,7 @@
def echo_failure(text, nl=True):
- click.secho(text, fg='red', bold=True, nl=nl)
+ click.secho(text, fg='red', bold=True, nl=nl, err=True)
def echo_warning(text, nl=True):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/userpath-1.3.0/userpath/interface.py
new/userpath-1.4.1/userpath/interface.py
--- old/userpath-1.3.0/userpath/interface.py 2019-07-18 18:07:41.000000000
+0200
+++ new/userpath-1.4.1/userpath/interface.py 2020-06-25 18:12:53.000000000
+0200
@@ -1,28 +1,37 @@
import os
import platform
-import subprocess
from datetime import datetime
from io import open
from .shells import DEFAULT_SHELLS, SHELLS
from .utils import ensure_parent_dir_exists, get_flat_output,
get_parent_process_name, location_in_path, normpath
+try:
+ import winreg
+except ImportError:
+ try:
+ import _winreg as winreg
+ except ImportError:
+ winreg = None
+
class WindowsInterface:
def __init__(self, **kwargs):
pass
+ @staticmethod
+ def _get_new_path():
+ with winreg.OpenKey(winreg.HKEY_CURRENT_USER, 'Environment', 0,
winreg.KEY_READ) as key:
+ return winreg.QueryValueEx(key, 'PATH')[0]
+
def location_in_new_path(self, location, check=False):
locations = normpath(location).split(os.pathsep)
- show_path_command = ['powershell', '-Command', "&
{[Environment]::GetEnvironmentVariable('PATH', 'User')}"]
- new_path = get_flat_output(show_path_command, sep='', shell=True)
+ new_path = self._get_new_path()
for location in locations:
if not location_in_path(location, new_path):
if check:
- raise Exception(
- 'Unable to find `{}` in the output of
`{}`:\n{}'.format(location, show_path_command, new_path)
- )
+ raise Exception('Unable to find `{}`
in:\n{}'.format(location, new_path))
else:
return False
else:
@@ -31,36 +40,11 @@
def put(self, location, front=True, check=False, **kwargs):
location = normpath(location)
- # PowerShell should always be available on Windows 7 or later.
- try:
- old_path = os.environ.get('PATH', '')
- head, tail = (location, old_path) if front else (old_path,
location)
- new_path = '{}{}{}'.format(head, os.pathsep, tail)
-
- subprocess.check_output(
- [
- 'powershell',
- '-Command',
- "& {{[Environment]::SetEnvironmentVariable('PATH', '{}',
'User')}}".format(new_path),
- ],
- shell=True,
- )
- except subprocess.CalledProcessError: # no cov
- try:
- head, tail = (location, '%~a') if front else ('%~a', location)
- new_path = '{}{}{}'.format(head, os.pathsep, tail)
-
- # https://superuser.com/a/601034/766960
- subprocess.check_output(
- (
- 'for /f "skip=2 tokens=3*" %a in (\'reg query
HKCU\\Environment '
- '/v PATH\') do @if [%b]==[] ( @setx PATH "{new_path}"
) else '
- '( @setx PATH "{new_path} %~b"
)'.format(new_path=new_path)
- ),
- shell=True,
- )
- except subprocess.CalledProcessError:
- return False
+ head, tail = (location, self._get_new_path()) if front else
(self._get_new_path(), location)
+ new_path = '{}{}{}'.format(head, os.pathsep, tail)
+
+ with winreg.OpenKey(winreg.HKEY_CURRENT_USER, 'Environment', 0,
winreg.KEY_WRITE) as key:
+ winreg.SetValueEx(key, 'PATH', 0, winreg.REG_EXPAND_SZ, new_path)
return self.location_in_new_path(location, check=check)
@@ -143,6 +127,9 @@
else:
lines = []
+ if any(contents in line for line in lines):
+ continue
+
lines.append(
u'\n{} Created by `{}` on {}\n'.format(
shell.comment_starter, app_name,
datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/userpath-1.3.0/userpath.egg-info/PKG-INFO
new/userpath-1.4.1/userpath.egg-info/PKG-INFO
--- old/userpath-1.3.0/userpath.egg-info/PKG-INFO 2019-10-20
15:37:21.000000000 +0200
+++ new/userpath-1.4.1/userpath.egg-info/PKG-INFO 2020-06-25
18:19:01.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.2
Name: userpath
-Version: 1.3.0
+Version: 1.4.1
Summary: Cross-platform tool for adding locations to the user PATH, no
elevated privileges required!
Home-page: https://github.com/ofek/userpath
Author: Ofek Lev
@@ -124,6 +124,13 @@
Important changes are emphasized.
+ 1.4.0
+ ^^^^^
+
+ - Fix duplicating system paths on Windows
+ - Prevent adding paths multiple times on macOS/Linux
+ - Send CLI errors to stderr instead of stdout
+
1.3.0
^^^^^
@@ -153,5 +160,7 @@
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
+Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy