Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix winreg usage for python2 on windows #1316

Merged
merged 1 commit into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog/1315.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix import and usage of ``winreg`` for python2.7 on windows - by :user:`asottile`.
4 changes: 2 additions & 2 deletions src/tox/interpreters/windows/pep514.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import re

import six
import winreg
from six.moves import winreg

from tox import reporter
from tox.interpreters.py_spec import PythonSpec
Expand Down Expand Up @@ -52,7 +52,7 @@ def discover_pythons():

def process_set(hive, hive_name, key, flags, default_arch):
try:
with winreg.OpenKeyEx(hive, key, access=winreg.KEY_READ | flags) as root_key:
with winreg.OpenKeyEx(hive, key, 0, winreg.KEY_READ | flags) as root_key:
for company in enum_keys(root_key):
if company == "PyLauncher": # reserved
continue
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ include_trailing_comma = True
force_grid_wrap = 0
line_length = 99
known_first_party = tox,tests
known_third_party = apiclient,docutils,filelock,flaky,freezegun,git,httplib2,oauth2client,packaging,pathlib2,pkg_resources,pluggy,py,pytest,setuptools,six,sphinx,toml,winreg
known_third_party = apiclient,docutils,filelock,flaky,freezegun,git,httplib2,oauth2client,packaging,pathlib2,pkg_resources,pluggy,py,pytest,setuptools,six,sphinx,toml

[testenv:release]
description = do a release, required posarg of the version number
Expand Down