Skip to content

Commit

Permalink
Merge pull request #16 from jim-hart/windows-performance-fix
Browse files Browse the repository at this point in the history
Fixed performance issue affecting Windows users.
  • Loading branch information
mandeep authored Nov 17, 2019
2 parents 2a9fa46 + 0daa7d8 commit feab17d
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,18 +454,28 @@ def remove_channel(self, index):
class ExecuteCondaEnvironmentCommand(CondaCommand):
"""Override Sublime Text's default ExecCommand with a targeted build."""

# :type tuple[int]: Used to cache conda version number to avoid
# repeated calls to `conda info --json`.
_conda_version = None

os_env_path = os.environ['PATH']

@property
def conda_version(self):
"""
Returns this system's conda version in the form (major, minor, micro).
"""
response = subprocess.check_output(
[self.executable, '-m', 'conda', 'info', '--json'],
startupinfo=self.startupinfo)
conda_info = json.loads(response.decode())
return tuple(int(n) for n in conda_info['conda_version'].split('.'))
cls = type(self)

if cls._conda_version is None:
response = subprocess.check_output(
[self.executable, '-m', 'conda', 'info', '--json'],
startupinfo=self.startupinfo)

parsed = json.loads(response.decode())['conda_version']
cls._conda_version = tuple(int(n) for n in parsed.split('.'))

return cls._conda_version

def __enter__(self):
"""
Expand Down

0 comments on commit feab17d

Please sign in to comment.