Commit 8f8e190d by Jason Racine Committed by Arun Babu Neelicattu

remove some instances of branching code supporting older python versions

parent 3bbec0c6
...@@ -30,12 +30,12 @@ to activate one explicitly, see [Switching environments](#switching-between-envi ...@@ -30,12 +30,12 @@ to activate one explicitly, see [Switching environments](#switching-between-envi
To easily switch between Python versions, it is recommended to To easily switch between Python versions, it is recommended to
use [pyenv](https://github.com/pyenv/pyenv) or similar tools. use [pyenv](https://github.com/pyenv/pyenv) or similar tools.
For instance, if your project is Python 2.7 only, a standard workflow For instance, if your project is Python 3.6 only, a standard workflow
would be: would be:
```bash ```bash
pyenv install 2.7.15 pyenv install 3.6.15
pyenv local 2.7.15 # Activate Python 2.7 for the current project pyenv local 3.6.15 # Activate Python 3.6 for the current project
poetry install poetry install
``` ```
{{% /note %}} {{% /note %}}
......
...@@ -63,11 +63,7 @@ class InstalledRepository(Repository): ...@@ -63,11 +63,7 @@ class InstalledRepository(Repository):
if line and not line.startswith(("#", "import ", "import\t")): if line and not line.startswith(("#", "import ", "import\t")):
path = Path(line) path = Path(line)
if not path.is_absolute(): if not path.is_absolute():
try: path = lib.joinpath(path).resolve()
path = lib.joinpath(path).resolve()
except FileNotFoundError:
# this is required to handle pathlib oddity on win32 python==3.5
path = lib.joinpath(path)
paths.add(path) paths.add(path)
src_path = env.path / "src" / name src_path = env.path / "src" / name
......
...@@ -230,8 +230,6 @@ class MakeReleaseCommand(Command): ...@@ -230,8 +230,6 @@ class MakeReleaseCommand(Command):
subprocess.check_output( subprocess.check_output(
[python, "-V"], stderr=subprocess.STDOUT, shell=WINDOWS [python, "-V"], stderr=subprocess.STDOUT, shell=WINDOWS
) )
if version == "3.4" and WINDOWS:
continue
subprocess.check_output([python, "-m", "pip", "install", "pip", "-U"]) subprocess.check_output([python, "-m", "pip", "install", "pip", "-U"])
except subprocess.CalledProcessError: except subprocess.CalledProcessError:
......
...@@ -2,7 +2,6 @@ from __future__ import unicode_literals ...@@ -2,7 +2,6 @@ from __future__ import unicode_literals
import itertools import itertools
import json import json
import sys
from pathlib import Path from pathlib import Path
...@@ -1751,11 +1750,7 @@ def test_installer_test_solver_finds_compatible_package_for_dependency_python_no ...@@ -1751,11 +1750,7 @@ def test_installer_test_solver_finds_compatible_package_for_dependency_python_no
expected = fixture("with-conditional-dependency") expected = fixture("with-conditional-dependency")
assert locker.written_data == expected assert locker.written_data == expected
assert 1 == installer.executor.installations_count
if sys.version_info >= (3, 5, 0):
assert 1 == installer.executor.installations_count
else:
assert 0 == installer.executor.installations_count
def test_installer_required_extras_should_not_be_removed_when_updating_single_dependency( def test_installer_required_extras_should_not_be_removed_when_updating_single_dependency(
......
from __future__ import unicode_literals from __future__ import unicode_literals
import itertools import itertools
import sys
from pathlib import Path from pathlib import Path
...@@ -1447,11 +1446,7 @@ def test_installer_test_solver_finds_compatible_package_for_dependency_python_no ...@@ -1447,11 +1446,7 @@ def test_installer_test_solver_finds_compatible_package_for_dependency_python_no
assert locker.written_data == expected assert locker.written_data == expected
installs = installer.installer.installs installs = installer.installer.installs
assert len(installs) == 1
if sys.version_info >= (3, 5, 0):
assert len(installs) == 1
else:
assert len(installs) == 0
def test_installer_required_extras_should_not_be_removed_when_updating_single_dependency( def test_installer_required_extras_should_not_be_removed_when_updating_single_dependency(
......
...@@ -308,10 +308,7 @@ class test(Command): ...@@ -308,10 +308,7 @@ class test(Command):
build_cmd = self.get_finalized_command("build") build_cmd = self.get_finalized_command("build")
build_cmd.run() build_cmd.run()
sys.path.insert(0, build_cmd.build_lib) sys.path.insert(0, build_cmd.build_lib)
if sys.version_info[0] < 3: sys.path.insert(0, "tests/lib3")
sys.path.insert(0, "tests/lib")
else:
sys.path.insert(0, "tests/lib3")
import test_all import test_all
if not test_all.main([]): if not test_all.main([]):
...@@ -337,7 +334,7 @@ if __name__ == "__main__": ...@@ -337,7 +334,7 @@ if __name__ == "__main__":
url=URL, url=URL,
download_url=DOWNLOAD_URL, download_url=DOWNLOAD_URL,
classifiers=CLASSIFIERS, classifiers=CLASSIFIERS,
package_dir={"": {2: "lib", 3: "lib3"}[sys.version_info[0]]}, package_dir={"": "lib3"},
packages=["yaml"], packages=["yaml"],
ext_modules=[ ext_modules=[
Extension( Extension(
......
...@@ -12,8 +12,6 @@ from setuptools import find_packages ...@@ -12,8 +12,6 @@ from setuptools import find_packages
from setuptools.command.test import test as TestCommand from setuptools.command.test import test as TestCommand
cmdclass = {} cmdclass = {}
if sys.version_info < (2, 7):
raise Exception("SQLAlchemy requires Python 2.7 or higher.")
cpython = platform.python_implementation() == "CPython" cpython = platform.python_implementation() == "CPython"
......
...@@ -963,12 +963,7 @@ def test_env_system_packages(tmp_path, config): ...@@ -963,12 +963,7 @@ def test_env_system_packages(tmp_path, config):
EnvManager(config).build_venv(path=venv_path, flags={"system-site-packages": True}) EnvManager(config).build_venv(path=venv_path, flags={"system-site-packages": True})
if sys.version_info >= (3, 3): assert "include-system-site-packages = true" in pyvenv_cfg.read_text()
assert "include-system-site-packages = true" in pyvenv_cfg.read_text()
elif (2, 6) < sys.version_info < (3, 0):
assert not venv_path.joinpath(
"lib", "python2.7", "no-global-site-packages.txt"
).exists()
def test_env_finds_the_correct_executables(tmp_dir, manager): def test_env_finds_the_correct_executables(tmp_dir, manager):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment