[LNT] r309414 - Simplify path_has_no_database_type
Matthias Braun via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 28 11:02:46 PDT 2017
Author: matze
Date: Fri Jul 28 11:02:46 2017
New Revision: 309414
URL: http://llvm.org/viewvc/llvm-project?rev=309414&view=rev
Log:
Simplify path_has_no_database_type
Make it just check for `://` in the string, before it would miss
things like `mysql+mysqldb://` because the `+` was unexpected at the
front. (And for the record: This turned out not to be the database URL I
wanted, but good to fix it anyway).
Modified:
lnt/trunk/lnt/lnttool/create.py
lnt/trunk/lnt/server/db/util.py
Modified: lnt/trunk/lnt/lnttool/create.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/create.py?rev=309414&r1=309413&r2=309414&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/create.py (original)
+++ lnt/trunk/lnt/lnttool/create.py Fri Jul 28 11:02:46 2017
@@ -116,6 +116,7 @@ LNT configuration.
from .common import init_logger
import hashlib
import lnt.server.db.migrate
+ import lnt.server.db.util
import lnt.testing
import logging
import os
@@ -146,7 +147,7 @@ LNT configuration.
os.mkdir(schemas_path)
# If the path does not contain database type, assume relative path.
- if "://" not in db_dir:
+ if lnt.server.db.util.path_has_no_database_type(db_dir):
db_dir_path = os.path.join(basepath, db_dir)
db_path = os.path.join(db_dir_path, default_db)
os.mkdir(db_dir_path)
Modified: lnt/trunk/lnt/server/db/util.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/db/util.py?rev=309414&r1=309413&r2=309414&view=diff
==============================================================================
--- lnt/trunk/lnt/server/db/util.py (original)
+++ lnt/trunk/lnt/server/db/util.py Fri Jul 28 11:02:46 2017
@@ -2,11 +2,9 @@ import sqlalchemy
import sqlalchemy.ext.compiler
import re
-PATH_DATABASE_TYPE_RE = re.compile('\w+\:\/\/')
-
def path_has_no_database_type(path):
- return PATH_DATABASE_TYPE_RE.match(path) is None
+ return '://' not in path
def _alter_table_statement(dialect, table_name, column):
More information about the llvm-commits
mailing list