Linter Core: change lots of behaviour
* Use the Django migration classes to manipulate these objects this includes the discovery of migrations through the MigrationLoader (instead of manually walking through the Django project and find the migrations through a regex) and representing a Migration through the Django class. * Get the SQL of a migration through a 'call_command' call of 'sqlmigrate' That speeds up greatly the linter since we don't have to setup Django for each migration * Add the database to the cache path
This commit is contained in:
1 parent
0eb584889a
commit
484a775fda
4 files changed
+122
-272
No files matched your search
@@ -15,14 +15,13 @@
|
||||
import os
|
||||
import pickle
|
||||
|
||||
from .utils import split_path
|
||||
|
||||
|
||||
class Cache(dict):
|
||||
def __init__(self, django_folder, cache_path):
|
||||
self.django_folder = django_folder
|
||||
project_name = split_path(django_folder)[-1]
|
||||
self.filename = os.path.join(cache_path, "{0}.pickle".format(project_name))
|
||||
def __init__(self, django_folder, database, cache_path):
|
||||
self.filename = os.path.join(
|
||||
cache_path,
|
||||
"{0}_{1}.pickle".format(django_folder.replace(os.sep, "_"), database),
|
||||
)
|
||||
|
||||
if not os.path.exists(os.path.dirname(self.filename)):
|
||||
os.makedirs(os.path.dirname(self.filename))
|
||||
|
||||
Reference in new issue
Block a user