Merge pull request #352 from szotov/windows

Minor improvements for Windows compatibility
pull/370/merge
K Prasch 2018-07-18 09:13:07 -07:00 committed by GitHub
commit 18cddabe4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View File

@ -1,4 +1,4 @@
import distutils
import shutil
import itertools
import os
@ -9,11 +9,13 @@ from solc.exceptions import SolcError
class SolidityCompiler:
__default_version = 'v0.4.22'
__default_version = 'v0.4.24'
__default_configuration_path = os.path.join(dirname(abspath(__file__)), './compiler.json')
__bin_path = os.path.dirname(distutils.spawn.find_executable('python'))
__default_sol_binary_path = os.path.join(__bin_path, 'solc')
__default_sol_binary_path = shutil.which('solc')
if __default_sol_binary_path is None:
__bin_path = os.path.dirname(shutil.which('python'))
__default_sol_binary_path = os.path.join(__bin_path, 'solc')
__default_contract_dir = os.path.join(dirname(abspath(__file__)), 'source', 'contracts')
__default_chain_name = 'tester'

View File

@ -125,7 +125,7 @@ def check_config_tree(configuration_dir: str=None) -> bool:
def check_config_runtime() -> bool:
rules = (
(os.getuid() != 0, 'Cannot run as root user.'),
(os.name == 'nt' or os.getuid() != 0, 'Cannot run as root user.'),
)
for rule, failure_reason in rules:

View File

@ -40,8 +40,9 @@ def tempfile_path():
"""
User is responsible for closing the file given at the path.
"""
_, path = tempfile.mkstemp()
fd, path = tempfile.mkstemp()
yield path
os.close(fd)
os.remove(path)