Hello community,

here is the log from the commit of package python-dephell-pythons for 
openSUSE:Factory checked in at 2020-03-04 09:46:50
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-dephell-pythons (Old)
 and      /work/SRC/openSUSE:Factory/.python-dephell-pythons.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-dephell-pythons"

Wed Mar  4 09:46:50 2020 rev:3 rq:781257 version:0.1.14

Changes:
--------
--- 
/work/SRC/openSUSE:Factory/python-dephell-pythons/python-dephell-pythons.changes
    2019-09-13 15:05:08.537258982 +0200
+++ 
/work/SRC/openSUSE:Factory/.python-dephell-pythons.new.26092/python-dephell-pythons.changes
 2020-03-04 09:47:07.806169621 +0100
@@ -1,0 +2,15 @@
+Tue Mar  3 15:24:21 CET 2020 - Matej Cepl <[email protected]>
+
+- Update to 0.1.14:
+  - carefully check access to everything
+  - sort all imports
+  - check read access for dir
+  - rename flag
+  - ignore pythonz
+  - fix typing
+  - Fix the code for Windows
+  - Remove redundant exception type
+  - Revert finder changes
+  - make python script fixture
+
+-------------------------------------------------------------------

Old:
----
  dephell_pythons-0.1.12.tar.gz

New:
----
  dephell_pythons-0.1.14.tar.gz

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

Other differences:
------------------
++++++ python-dephell-pythons.spec ++++++
--- /var/tmp/diff_new_pack.PpRCO5/_old  2020-03-04 09:47:08.778170204 +0100
+++ /var/tmp/diff_new_pack.PpRCO5/_new  2020-03-04 09:47:08.782170206 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-dephell-pythons
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 %define skip_python2 1
 Name:           python-dephell-pythons
-Version:        0.1.12
+Version:        0.1.14
 Release:        0
 Summary:        Dephell library to manage python versions
 License:        MIT

++++++ dephell_pythons-0.1.12.tar.gz -> dephell_pythons-0.1.14.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/PKG-INFO 
new/dephell_pythons-0.1.14/PKG-INFO
--- old/dephell_pythons-0.1.12/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
+++ new/dephell_pythons-0.1.14/PKG-INFO 1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: dephell-pythons
-Version: 0.1.12
+Version: 0.1.14
 Summary: Work with python versions
 Project-URL: Repository, https://github.com/dephell/dephell
 Author: Gram
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/dephell_pythons/__init__.py 
new/dephell_pythons-0.1.14/dephell_pythons/__init__.py
--- old/dephell_pythons-0.1.12/dephell_pythons/__init__.py      2019-04-20 
09:45:36.000000000 +0200
+++ new/dephell_pythons-0.1.14/dephell_pythons/__init__.py      2019-12-18 
15:15:47.000000000 +0100
@@ -1,8 +1,10 @@
+# app
 from ._finder import Finder
 from ._python import Python
 from ._pythons import Pythons
 from ._windows import WindowsFinder
 
+
 __all__ = [
     'Finder',
     'Python',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/dephell_pythons/__main__.py 
new/dephell_pythons-0.1.14/dephell_pythons/__main__.py
--- old/dephell_pythons-0.1.12/dephell_pythons/__main__.py      2019-04-22 
18:47:33.000000000 +0200
+++ new/dephell_pythons-0.1.14/dephell_pythons/__main__.py      2019-12-18 
15:15:47.000000000 +0100
@@ -1,5 +1,7 @@
+# built-in
 import json
 
+# app
 from ._pythons import Pythons
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/dephell_pythons/_constants.py 
new/dephell_pythons-0.1.14/dephell_pythons/_constants.py
--- old/dephell_pythons-0.1.12/dephell_pythons/_constants.py    2019-04-20 
09:45:36.000000000 +0200
+++ new/dephell_pythons-0.1.14/dephell_pythons/_constants.py    2019-12-18 
15:15:47.000000000 +0100
@@ -1,3 +1,4 @@
+# built-in
 import os
 import platform
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/dephell_pythons/_finder.py 
new/dephell_pythons-0.1.14/dephell_pythons/_finder.py
--- old/dephell_pythons-0.1.12/dephell_pythons/_finder.py       2019-04-22 
18:47:33.000000000 +0200
+++ new/dephell_pythons-0.1.14/dephell_pythons/_finder.py       2019-12-18 
15:15:47.000000000 +0100
@@ -1,17 +1,21 @@
+# built-in
 import os
 import subprocess
 from fnmatch import fnmatch
 from functools import lru_cache
 from operator import attrgetter
-from packaging.version import Version
 from pathlib import Path
-from typing import Optional, List, Iterable, Iterator
+from typing import Iterable, Iterator, List, Optional
 
+# external
 import attr
+from packaging.version import Version
 
+# app
 from ._cached_property import cached_property
 from ._constants import PYTHON_IMPLEMENTATIONS, SUFFIX_PATTERNS
 from ._python import Python
+from ._shell_utils import is_dir, is_executable
 
 
 @attr.s(frozen=True, hash=True)
@@ -103,19 +107,18 @@
 
     @staticmethod
     def get_implementation(path: Path) -> Optional[str]:
+        if path.name.startswith('pythonz'):
+            return None
         for implementation in PYTHON_IMPLEMENTATIONS:
             if path.name.startswith(implementation):
                 return implementation
         return None
 
-    def is_python(self, path: Path) -> bool:
-        # https://stackoverflow.com/a/377028/8704691
-        try:
-            if not path.is_file():
-                return False
-        except PermissionError:
-            return False
-        if not os.access(str(path), os.X_OK):
+    def is_python(self, path: Path, check_access: bool = True) -> bool:
+        """
+        check_access -- check file existence and execution access
+        """
+        if check_access and not is_executable(path):
             return False
 
         implementation = self.get_implementation(path=path)
@@ -137,11 +140,14 @@
             paths = self.paths
         for path in paths:
             # single binary
-            if path.is_file():
-                if self.is_python(path=path):
+            if is_executable(path):
+                if self.is_python(path=path, check_access=False):
                     yield path
                 continue
 
+            if not is_dir(path):
+                continue
+
             # directory with executables
             for executable in path.iterdir():
                 if self.is_python(path=executable):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/dephell_pythons/_python.py 
new/dephell_pythons-0.1.14/dephell_pythons/_python.py
--- old/dephell_pythons-0.1.12/dephell_pythons/_python.py       2019-04-22 
18:47:33.000000000 +0200
+++ new/dephell_pythons-0.1.14/dephell_pythons/_python.py       2019-12-18 
15:15:47.000000000 +0100
@@ -7,6 +7,7 @@
 import attr
 from packaging.version import Version
 
+# app
 from ._cached_property import cached_property
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/dephell_pythons/_pythons.py 
new/dephell_pythons-0.1.14/dephell_pythons/_pythons.py
--- old/dephell_pythons-0.1.12/dephell_pythons/_pythons.py      2019-04-22 
18:31:34.000000000 +0200
+++ new/dephell_pythons-0.1.14/dephell_pythons/_pythons.py      2019-12-18 
15:15:47.000000000 +0100
@@ -13,7 +13,7 @@
 from dephell_specifier import RangeSpecifier
 
 # app
-from ._constants import PYTHONS, IS_WINDOWS
+from ._constants import IS_WINDOWS, PYTHONS
 from ._finder import Finder
 from ._python import Python
 from ._windows import WindowsFinder
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dephell_pythons-0.1.12/dephell_pythons/_shell_utils.py 
new/dephell_pythons-0.1.14/dephell_pythons/_shell_utils.py
--- old/dephell_pythons-0.1.12/dephell_pythons/_shell_utils.py  1970-01-01 
01:00:00.000000000 +0100
+++ new/dephell_pythons-0.1.14/dephell_pythons/_shell_utils.py  2019-12-30 
14:42:12.000000000 +0100
@@ -0,0 +1,36 @@
+# built-in
+import os
+from pathlib import Path
+
+
+# https://stackoverflow.com/a/377028/8704691
+def is_executable(path: Path) -> bool:
+    """
+    1. It exists
+    2. It's a file
+    3. We can execute it
+    """
+    try:
+        if not path.is_file():
+            return False
+    except OSError:
+        return False
+    if not os.access(str(path), os.X_OK):
+        return False
+    return True
+
+
+def is_dir(path: Path) -> bool:
+    """
+    1. It exists
+    2. It's a dir
+    3. We can read it
+    """
+    try:
+        if not path.is_dir():
+            return False
+    except OSError:
+        return False
+    if not os.access(str(path), os.R_OK):
+        return False
+    return True
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/dephell_pythons/_windows.py 
new/dephell_pythons-0.1.14/dephell_pythons/_windows.py
--- old/dephell_pythons-0.1.12/dephell_pythons/_windows.py      2019-04-20 
09:45:36.000000000 +0200
+++ new/dephell_pythons-0.1.14/dephell_pythons/_windows.py      2019-12-30 
14:42:12.000000000 +0100
@@ -1,8 +1,11 @@
+# built-in
 from pathlib import Path
 from typing import List
 
+# external
 from packaging.version import Version
 
+# app
 from ._cached_property import cached_property
 from ._python import Python
 
@@ -14,12 +17,13 @@
 
         pythons = []
         for env in findall():
-            path = getattr(env.info._d['InstallPath'], 'executable_path', None)
+            d = env.info._d
+            path = getattr(d.get('InstallPath'), 'executable_path', None)
             if path is None:
-                path = getattr(env.info._d['InstallPath'], '', None)
+                path = getattr(d.get('InstallPath'), '', None)
                 if path is None:
                     continue
-            version = str(env.info._d['Version'])
+            version = str(d['Version'])
             # conda returns it's own version
             if version[0] not in '23':
                 continue
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dephell_pythons-0.1.12/dephell_pythons/pep514tools/__init__.py 
new/dephell_pythons-0.1.14/dephell_pythons/pep514tools/__init__.py
--- old/dephell_pythons-0.1.12/dephell_pythons/pep514tools/__init__.py  
2019-05-23 20:45:28.000000000 +0200
+++ new/dephell_pythons-0.1.14/dephell_pythons/pep514tools/__init__.py  
2019-12-30 14:42:13.000000000 +0100
@@ -6,6 +6,6 @@
 #-------------------------------------------------------------------------
 
 __author__ = 'Steve Dower <[email protected]>'
-__version__ = '0.1.12'
+__version__ = '0.1.14'
 
 from .environment import findall, find, findone
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dephell_pythons-0.1.12/dephell_pythons.egg-info/PKG-INFO 
new/dephell_pythons-0.1.14/dephell_pythons.egg-info/PKG-INFO
--- old/dephell_pythons-0.1.12/dephell_pythons.egg-info/PKG-INFO        
1970-01-01 01:00:00.000000000 +0100
+++ new/dephell_pythons-0.1.14/dephell_pythons.egg-info/PKG-INFO        
1970-01-01 01:00:00.000000000 +0100
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: dephell-pythons
-Version: 0.1.12
+Version: 0.1.14
 Summary: Work with python versions
 Project-URL: Repository, https://github.com/dephell/dephell
 Author: Gram
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/dephell_pythons-0.1.12/dephell_pythons.egg-info/SOURCES.txt 
new/dephell_pythons-0.1.14/dephell_pythons.egg-info/SOURCES.txt
--- old/dephell_pythons-0.1.12/dephell_pythons.egg-info/SOURCES.txt     
1970-01-01 01:00:00.000000000 +0100
+++ new/dephell_pythons-0.1.14/dephell_pythons.egg-info/SOURCES.txt     
1970-01-01 01:00:00.000000000 +0100
@@ -2,15 +2,16 @@
 README.rst
 setup.cfg
 setup.py
+dephell_pythons/_shell_utils.py
 dephell_pythons/_cached_property.py
+dephell_pythons/_python.py
+dephell_pythons/_constants.py
+dephell_pythons/__init__.py
+dephell_pythons/_pythons.py
 dephell_pythons/__main__.py
 dephell_pythons/_finder.py
-dephell_pythons/__init__.py
 dephell_pythons/_windows.py
-dephell_pythons/_pythons.py
-dephell_pythons/_constants.py
-dephell_pythons/_python.py
 dephell_pythons/pep514tools/environment.py
+dephell_pythons/pep514tools/__init__.py
 dephell_pythons/pep514tools/_registry.py
-dephell_pythons/pep514tools/__main__.py
-dephell_pythons/pep514tools/__init__.py
\ No newline at end of file
+dephell_pythons/pep514tools/__main__.py
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/setup.py 
new/dephell_pythons-0.1.14/setup.py
--- old/dephell_pythons-0.1.12/setup.py 2019-05-23 20:45:30.000000000 +0200
+++ new/dephell_pythons-0.1.14/setup.py 2019-12-30 14:42:15.000000000 +0100
@@ -21,10 +21,10 @@
 setup(
     long_description=readme,
     name='dephell_pythons',
-    version='0.1.12',
+    version='0.1.14',
     description='Work with python versions',
     python_requires='>=3.5',
-    project_urls={'repository': 'https://github.com/dephell/dephell'},
+    project_urls={"repository": "https://github.com/dephell/dephell"},
     author='Gram',
     author_email='[email protected]',
     license='MIT',
@@ -37,6 +37,7 @@
         'Topic :: Software Development :: Libraries :: Python Modules'
     ],
     packages=['dephell_pythons', 'dephell_pythons.pep514tools'],
+    package_dir={"": "."},
     package_data={},
     install_requires=['attrs', 'dephell-specifier', 'packaging'],
 )
Binary files 
old/dephell_pythons-0.1.12/tests/__pycache__/__init__.cpython-37.pyc and 
new/dephell_pythons-0.1.14/tests/__pycache__/__init__.cpython-37.pyc differ
Binary files 
old/dephell_pythons-0.1.12/tests/__pycache__/test_abstract.cpython-37-PYTEST.pyc
 and 
new/dephell_pythons-0.1.14/tests/__pycache__/test_abstract.cpython-37-PYTEST.pyc
 differ
Binary files 
old/dephell_pythons-0.1.12/tests/__pycache__/test_finder.cpython-37-PYTEST.pyc 
and 
new/dephell_pythons-0.1.14/tests/__pycache__/test_finder.cpython-37-PYTEST.pyc 
differ
Binary files 
old/dephell_pythons-0.1.12/tests/__pycache__/test_getters.cpython-37-PYTEST.pyc 
and 
new/dephell_pythons-0.1.14/tests/__pycache__/test_getters.cpython-37-PYTEST.pyc 
differ
Binary files 
old/dephell_pythons-0.1.12/tests/__pycache__/test_python.cpython-37-PYTEST.pyc 
and 
new/dephell_pythons-0.1.14/tests/__pycache__/test_python.cpython-37-PYTEST.pyc 
differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/tests/python3.7 
new/dephell_pythons-0.1.14/tests/python3.7
--- old/dephell_pythons-0.1.12/tests/python3.7  2019-04-20 09:45:36.000000000 
+0200
+++ new/dephell_pythons-0.1.14/tests/python3.7  1970-01-01 01:00:00.000000000 
+0100
@@ -1,7 +0,0 @@
-#!/usr/bin/env bash
-if [[ $1 = '--version' ]]
-then echo "Python 3.7.0"
-else
-  echo "3.7.0 (default, Dec 24 2018, 12:47:36) "
-  echo "[GCC 5.4.0 20160609]"
-fi
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/dephell_pythons-0.1.12/tests/test_finder.py 
new/dephell_pythons-0.1.14/tests/test_finder.py
--- old/dephell_pythons-0.1.12/tests/test_finder.py     2019-04-20 
10:19:02.000000000 +0200
+++ new/dephell_pythons-0.1.14/tests/test_finder.py     2019-12-30 
14:42:12.000000000 +0100
@@ -1,23 +1,46 @@
 from shutil import which
 from pathlib import Path
+
+import pytest
+
 from dephell_pythons import Finder
 from dephell_pythons._windows import WindowsFinder
 from dephell_pythons._constants import IS_WINDOWS
 
 
-def test_is_python():
+CONTENT = """
+#!/usr/bin/env bash
+if [[ $1 = '--version' ]]
+then echo "Python 3.7.0"
+else
+  echo "3.7.0 (default, Dec 24 2018, 12:47:36) "
+  echo "[GCC 5.4.0 20160609]"
+fi
+"""
+
+
[email protected]
+def fake_python(tmp_path: Path):
+    path = tmp_path / 'python3.7'
+    path.write_text(CONTENT.strip())
+    path.chmod(0x777)
+    return path
+
+
+def test_is_python(fake_python: Path):
     f = Finder()
     if not IS_WINDOWS:
-        assert f.is_python(Path('tests', 'python3.7')) is True
-    assert f.is_python(Path('tests', 'python3.5')) is False     # doesn't exist
-    assert f.is_python(Path('tests', 'test_finder.py')) is False
+        assert f.is_python(fake_python) is True
+    root = Path(__file__).parent
+    assert f.is_python(root / 'python3.5') is False     # doesn't exist
+    assert f.is_python(root / 'test_finder.py') is False
 
 
-def test_get_version():
+def test_get_version(fake_python: Path):
     if IS_WINDOWS:
         return
     f = Finder()
-    assert f.get_version(Path('tests', 'python3.7')) == '3.7.0'
+    assert f.get_version(fake_python) == '3.7.0'
 
 
 def test_get_pythons_real():
@@ -31,10 +54,10 @@
         assert which('python3').lower() in [str(p.path).lower() for p in 
f.pythons]
 
 
-def test_get_pythons_fake():
+def test_get_pythons_fake(fake_python: Path):
     if IS_WINDOWS:
         return
     f = Finder()
-    pythons = list(f.get_pythons([Path('tests')]))
+    pythons = list(f.get_pythons([fake_python.parent]))
     assert len(pythons) == 1
     assert pythons[0].name == 'python3.7'


Reply via email to