Use python exe in current venv
This commit is contained in:
1 parent
8adffed958
commit
dcbcb0883c
1 file changed
+6
-3
@@ -43,6 +43,7 @@ class MigrationLinter(object):
|
||||
self.include_apps = kwargs.get('include_apps', None)
|
||||
self.exclude_apps = kwargs.get('exclude_apps', None)
|
||||
self.database = kwargs.get('database', None) or 'default'
|
||||
self.python_exe = '{0}/bin/{1}'.format(sys.prefix, 'python') if hasattr(sys, 'real_prefix') else 'python'
|
||||
|
||||
# Initialise counters
|
||||
self.nb_valid = 0
|
||||
@@ -125,9 +126,11 @@ class MigrationLinter(object):
|
||||
"""
|
||||
git_diff_command = (
|
||||
'cd {0} && '
|
||||
'python manage.py sqlmigrate {1} {2} '
|
||||
'--database {3}').format(
|
||||
self.django_path, app_name, migration_name, self.database)
|
||||
'{1} manage.py sqlmigrate {2} {3} '
|
||||
'--database {4}').format(
|
||||
self.django_path,
|
||||
self.python_exe, app_name, migration_name,
|
||||
self.database)
|
||||
log.info('Executing {0}'.format(git_diff_command))
|
||||
sqlmigrate_process = Popen(
|
||||
git_diff_command, shell=True, stdout=PIPE, stderr=PIPE)
|
||||
|
||||
Reference in new issue
Block a user