diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2011-08-03 14:39:08 -0400 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2011-08-03 14:39:31 -0400 |
commit | 327f29e7e76648cb13d5ab92a05f72133275f6c2 (patch) | |
tree | 27f9aa1585c9fee1476f1606233fa9e79c64a6da | |
parent | 8e1d579d7e307062e80c1a2307080b88eda74daf (diff) | |
download | askbot-327f29e7e76648cb13d5ab92a05f72133275f6c2.tar.gz askbot-327f29e7e76648cb13d5ab92a05f72133275f6c2.tar.bz2 askbot-327f29e7e76648cb13d5ab92a05f72133275f6c2.zip |
fixed path to the brief instruction text file, made askbot deploy without errors when installed into the source code directory, removed directory askbot/docs, now only have askbot/doc
-rw-r--r-- | askbot/deployment/__init__.py | 2 | ||||
-rw-r--r-- | askbot/deployment/path_utils.py | 29 | ||||
-rw-r--r-- | askbot/doc/INSTALL (renamed from askbot/docs/INSTALL) | 0 |
3 files changed, 25 insertions, 6 deletions
diff --git a/askbot/deployment/__init__.py b/askbot/deployment/__init__.py index b0a87d15..3f04e39d 100644 --- a/askbot/deployment/__init__.py +++ b/askbot/deployment/__init__.py @@ -93,7 +93,7 @@ def askbot_setup(): directory = None continue - help_file = os.path.join(directory, 'askbot', 'doc', 'INSTALL') + help_file = path_utils.get_path_to_help_file() if create_new: path_utils.create_path(directory) path_utils.deploy_into(directory, new_project = True) diff --git a/askbot/deployment/path_utils.py b/askbot/deployment/path_utils.py index eb32e4e5..7a1197de 100644 --- a/askbot/deployment/path_utils.py +++ b/askbot/deployment/path_utils.py @@ -108,7 +108,15 @@ def create_path(directory): else: os.makedirs(directory) +def touch(file_path, times = None): + #http://stackoverflow.com/questions/1158076/implement-touch-using-python + with file(file_path, 'a'): + os.utime(file_path, times) + SOURCE_DIR = os.path.dirname(os.path.dirname(__file__)) +def get_path_to_help_file(): + return os.path.join(SOURCE_DIR, 'doc', 'INSTALL') + def deploy_into(directory, new_project = None): """will copy necessary files into the directory """ @@ -130,19 +138,30 @@ def deploy_into(directory, new_project = None): shutil.copy(src, directory) #copy log directory src = os.path.join(SOURCE_DIR, 'setup_templates', 'log') - dst = os.path.join(directory, 'log') - shutil.copytree(src, dst) + log_dir = os.path.join(directory, 'log') + create_path(log_dir) + touch(os.path.join(log_dir, 'askbot.log')) print '' app_dir = os.path.join(directory, 'askbot') - print 'copying directories: ', copy_dirs = ('doc','cron','upfiles') + dirs_copied = 0 for dir_name in copy_dirs: src = os.path.join(SOURCE_DIR, dir_name) dst = os.path.join(app_dir, dir_name) - print dir_name + ' ', - shutil.copytree(src, dst) + if os.path.abspath(src) != os.path.abspath(dst): + if dirs_copied == 0: + print 'copying directories: ', + print '* ' + dir_name + if os.path.exists(dst): + if os.path.isdir(dst): + print 'Directory %s not empty - skipped' % dst + else: + print 'File %s already exists - skipped' % dst + continue + shutil.copytree(src, dst) + dirs_copied += 1 print '' def dir_name_acceptable(directory): diff --git a/askbot/docs/INSTALL b/askbot/doc/INSTALL index 37c55fb6..37c55fb6 100644 --- a/askbot/docs/INSTALL +++ b/askbot/doc/INSTALL |