##// END OF EJS Templates
cleanup: get rid of dn as shortcut for os.path.dirname...
domruf -
r5961:037efd94 default
parent child Browse files
Show More
@@ -31,7 +31,7 b' import sys'
31 31 import time
32 32 import uuid
33 33 import logging
34 from os.path import dirname as dn
34 from os.path import dirname
35 35
36 36 from kallithea import __dbversion__, __py_version__, EXTERN_TYPE_INTERNAL, DB_MIGRATIONS
37 37 from kallithea.model.user import UserModel
@@ -138,7 +138,7 b' class DbManage(object):'
138 138 print 'No upgrade performed'
139 139 sys.exit(0)
140 140
141 repository_path = os.path.join(dn(dn(dn(os.path.realpath(__file__)))),
141 repository_path = os.path.join(dirname(dirname(dirname(os.path.realpath(__file__)))),
142 142 'kallithea', 'lib', 'dbmigrate')
143 143 db_uri = self.dburi
144 144
@@ -28,10 +28,10 b' Original author and date, and relevant c'
28 28 import os
29 29 import sys
30 30 import logging
31 from os.path import dirname as dn
31 from os.path import dirname
32 32
33 33 # Add location of top level folder to sys.path
34 sys.path.append(dn(dn(dn(os.path.realpath(__file__)))))
34 sys.path.append(dirname(dirname(dirname(os.path.realpath(__file__)))))
35 35
36 36 from whoosh.analysis import RegexTokenizer, LowercaseFilter
37 37 from whoosh.fields import TEXT, ID, STORED, NUMERIC, BOOLEAN, Schema, FieldType, DATETIME
@@ -34,10 +34,10 b' import traceback'
34 34 from shutil import rmtree
35 35 from time import mktime
36 36
37 from os.path import dirname as dn
37 from os.path import dirname
38 38
39 39 # Add location of top level folder to sys.path
40 project_path = dn(dn(dn(dn(os.path.realpath(__file__)))))
40 project_path = dirname(dirname(dirname(dirname(os.path.realpath(__file__)))))
41 41 sys.path.append(project_path)
42 42
43 43 from kallithea.config.conf import INDEX_EXTENSIONS, INDEX_FILENAMES
@@ -35,8 +35,8 b' from kallithea.lib.utils import BasePast'
35 35 from kallithea.model.db import CacheInvalidation
36 36
37 37 # Add location of top level folder to sys.path
38 from os.path import dirname as dn
39 rc_path = dn(dn(dn(os.path.realpath(__file__))))
38 from os.path import dirname
39 rc_path = dirname(dirname(dirname(os.path.realpath(__file__))))
40 40 sys.path.append(rc_path)
41 41
42 42
@@ -38,8 +38,8 b' from kallithea.lib.utils2 import safe_st'
38 38 from kallithea.model.db import Ui
39 39
40 40 # Add location of top level folder to sys.path
41 from os.path import dirname as dn
42 rc_path = dn(dn(dn(os.path.realpath(__file__))))
41 from os.path import dirname
42 rc_path = dirname(dirname(dirname(os.path.realpath(__file__))))
43 43 sys.path.append(rc_path)
44 44
45 45
@@ -25,8 +25,8 b' from paste.script.appinstall import Abst'
25 25 from paste.script.command import BadCommand
26 26
27 27 # Add location of top level folder to sys.path
28 from os.path import dirname as dn
29 rc_path = dn(dn(dn(os.path.realpath(__file__))))
28 from os.path import dirname
29 rc_path = dirname(dirname(dirname(os.path.realpath(__file__))))
30 30 sys.path.append(rc_path)
31 31
32 32 class Command(AbstractInstallCommand):
@@ -32,8 +32,8 b' import sys'
32 32 from kallithea.lib.utils import BasePasterCommand
33 33
34 34 # Add location of top level folder to sys.path
35 from os.path import dirname as dn
36 rc_path = dn(dn(dn(os.path.realpath(__file__))))
35 from os.path import dirname
36 rc_path = dirname(dirname(dirname(os.path.realpath(__file__))))
37 37 sys.path.append(rc_path)
38 38
39 39
@@ -34,8 +34,8 b' from kallithea.model.repo import RepoMod'
34 34 from kallithea.lib.utils import BasePasterCommand, load_rcextensions
35 35
36 36 # Add location of top level folder to sys.path
37 from os.path import dirname as dn
38 rc_path = dn(dn(dn(os.path.realpath(__file__))))
37 from os.path import dirname
38 rc_path = dirname(dirname(dirname(os.path.realpath(__file__))))
39 39 sys.path.append(rc_path)
40 40
41 41
@@ -71,7 +71,7 b' class Command(BasePasterCommand):'
71 71 from kallithea.lib.pidlock import LockHeld, DaemonLock
72 72 from kallithea.lib.indexers.daemon import WhooshIndexingDaemon
73 73 try:
74 l = DaemonLock(file_=os.path.join(dn(dn(index_location)),
74 l = DaemonLock(file_=os.path.join(dirname(dirname(index_location)),
75 75 'make_index.lock'))
76 76 WhooshIndexingDaemon(index_location=index_location,
77 77 repo_location=repo_location,
@@ -33,8 +33,8 b' import pkg_resources'
33 33 from kallithea.lib.utils import BasePasterCommand, ask_ok
34 34
35 35 # Add location of top level folder to sys.path
36 from os.path import dirname as dn
37 rc_path = dn(dn(dn(os.path.realpath(__file__))))
36 from os.path import dirname
37 rc_path = dirname(dirname(dirname(os.path.realpath(__file__))))
38 38 sys.path.append(rc_path)
39 39
40 40
@@ -33,8 +33,8 b' from kallithea.model.scm import ScmModel'
33 33 from kallithea.lib.utils import BasePasterCommand, repo2db_mapper
34 34
35 35 # Add location of top level folder to sys.path
36 from os.path import dirname as dn
37 rc_path = dn(dn(dn(os.path.realpath(__file__))))
36 from os.path import dirname
37 rc_path = dirname(dirname(dirname(os.path.realpath(__file__))))
38 38 sys.path.append(rc_path)
39 39
40 40
@@ -26,8 +26,8 b' from paste.script.command import BadComm'
26 26 from paste.deploy import appconfig
27 27
28 28 # Add location of top level folder to sys.path
29 from os.path import dirname as dn
30 rc_path = dn(dn(dn(os.path.realpath(__file__))))
29 from os.path import dirname
30 rc_path = dirname(dirname(dirname(os.path.realpath(__file__))))
31 31 sys.path.append(rc_path)
32 32
33 33
@@ -36,8 +36,8 b' from kallithea.model.repo import RepoMod'
36 36 from kallithea.model.meta import Session
37 37
38 38 # Add location of top level folder to sys.path
39 from os.path import dirname as dn
40 rc_path = dn(dn(dn(os.path.realpath(__file__))))
39 from os.path import dirname
40 rc_path = dirname(dirname(dirname(os.path.realpath(__file__))))
41 41 sys.path.append(rc_path)
42 42
43 43
@@ -37,7 +37,7 b' import shutil'
37 37 import decorator
38 38 import warnings
39 39 from os.path import abspath
40 from os.path import dirname as dn
40 from os.path import dirname
41 41
42 42 from paste.script.command import Command, BadCommand
43 43
@@ -653,7 +653,7 b' def create_test_index(repo_location, con'
653 653 os.makedirs(index_location)
654 654
655 655 try:
656 l = DaemonLock(file_=os.path.join(dn(index_location), 'make_index.lock'))
656 l = DaemonLock(file_=os.path.join(dirname(index_location), 'make_index.lock'))
657 657 WhooshIndexingDaemon(index_location=index_location,
658 658 repo_location=repo_location) \
659 659 .run(full_index=full_index)
@@ -705,12 +705,12 b' def create_test_env(repos_test_path, con'
705 705 shutil.rmtree(data_path)
706 706
707 707 #CREATE DEFAULT TEST REPOS
708 cur_dir = dn(dn(abspath(__file__)))
708 cur_dir = dirname(dirname(abspath(__file__)))
709 709 tar = tarfile.open(os.path.join(cur_dir, 'tests', 'fixtures', "vcs_test_hg.tar.gz"))
710 710 tar.extractall(os.path.join(TESTS_TMP_PATH, HG_REPO))
711 711 tar.close()
712 712
713 cur_dir = dn(dn(abspath(__file__)))
713 cur_dir = dirname(dirname(abspath(__file__)))
714 714 tar = tarfile.open(os.path.join(cur_dir, 'tests', 'fixtures', "vcs_test_git.tar.gz"))
715 715 tar.extractall(os.path.join(TESTS_TMP_PATH, GIT_REPO))
716 716 tar.close()
@@ -27,9 +27,9 b' from kallithea.model.user_group import U'
27 27 from kallithea.model.gist import GistModel
28 28 from kallithea.model.scm import ScmModel
29 29 from kallithea.lib.vcs.backends.base import EmptyChangeset
30 from os.path import dirname
30 31
31 dn = os.path.dirname
32 FIXTURES = os.path.join(dn(dn(os.path.abspath(__file__))), 'tests', 'fixtures')
32 FIXTURES = os.path.join(dirname(dirname(os.path.abspath(__file__))), 'tests', 'fixtures')
33 33
34 34
35 35 def error_function(*args, **kwargs):
@@ -5,9 +5,9 b' from kallithea.tests import *'
5 5 from kallithea.model.db import UserLog
6 6 from kallithea.model.meta import Session
7 7 from kallithea.lib.utils2 import safe_unicode
8 from os.path import dirname
8 9
9 dn = os.path.dirname
10 FIXTURES = os.path.join(dn(dn(os.path.abspath(__file__))), 'fixtures')
10 FIXTURES = os.path.join(dirname(dirname(os.path.abspath(__file__))), 'fixtures')
11 11
12 12
13 13 class TestAdminController(TestController):
@@ -30,7 +30,7 b' import os'
30 30 import sys
31 31 import shutil
32 32 import logging
33 from os.path import dirname as dn
33 from os.path import dirname
34 34
35 35 from tempfile import _RandomNameSequence
36 36 from subprocess import Popen, PIPE
@@ -47,7 +47,7 b' from kallithea.lib.auth import get_crypt'
47 47 from kallithea.tests import HG_REPO
48 48 from kallithea.config.environment import load_environment
49 49
50 rel_path = dn(dn(dn(dn(os.path.abspath(__file__)))))
50 rel_path = dirname(dirname(dirname(dirname(os.path.abspath(__file__)))))
51 51 conf = appconfig('config:development.ini', relative_to=rel_path)
52 52 load_environment(conf.global_conf, conf.local_conf)
53 53
@@ -38,10 +38,10 b' import time'
38 38 import os
39 39 import sys
40 40 import tempfile
41 from os.path import dirname as dn
41 from os.path import dirname
42 42
43 43 __here__ = os.path.abspath(__file__)
44 __root__ = dn(dn(dn(__here__)))
44 __root__ = dirname(dirname(dirname(__here__)))
45 45 sys.path.append(__root__)
46 46
47 47 from kallithea.lib import vcs
General Comments 0
You need to be logged in to leave comments. Login now