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.include_apps = kwargs.get('include_apps', None)
|
||||||
self.exclude_apps = kwargs.get('exclude_apps', None)
|
self.exclude_apps = kwargs.get('exclude_apps', None)
|
||||||
self.database = kwargs.get('database', None) or 'default'
|
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
|
# Initialise counters
|
||||||
self.nb_valid = 0
|
self.nb_valid = 0
|
||||||
@@ -125,9 +126,11 @@ class MigrationLinter(object):
|
|||||||
"""
|
"""
|
||||||
git_diff_command = (
|
git_diff_command = (
|
||||||
'cd {0} && '
|
'cd {0} && '
|
||||||
'python manage.py sqlmigrate {1} {2} '
|
'{1} manage.py sqlmigrate {2} {3} '
|
||||||
'--database {3}').format(
|
'--database {4}').format(
|
||||||
self.django_path, app_name, migration_name, self.database)
|
self.django_path,
|
||||||
|
self.python_exe, app_name, migration_name,
|
||||||
|
self.database)
|
||||||
log.info('Executing {0}'.format(git_diff_command))
|
log.info('Executing {0}'.format(git_diff_command))
|
||||||
sqlmigrate_process = Popen(
|
sqlmigrate_process = Popen(
|
||||||
git_diff_command, shell=True, stdout=PIPE, stderr=PIPE)
|
git_diff_command, shell=True, stdout=PIPE, stderr=PIPE)
|
||||||
|
|||||||
Reference in new issue
Block a user