This commit is contained in:
Carl Meyer 2011-11-09 11:08:55 -07:00
Родитель da5f7fa0e6
Коммит 65dd84bf04
4 изменённых файлов: 78 добавлений и 19 удалений

0
deploy/__init__.py Normal file
Просмотреть файл

39
deploy/paths.py Normal file
Просмотреть файл

@ -0,0 +1,39 @@
# Case Conductor is a Test Case Management system.
# Copyright (C) 2011 uTest Inc.
#
# This file is part of Case Conductor.
#
# Case Conductor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Case Conductor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Case Conductor. If not, see <http://www.gnu.org/licenses/>.
import os, sys, site
def add_vendor_lib():
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
vendor_lib = os.path.join(
base_dir, "requirements", "vendor", "lib", "python")
orig_sys_path = set(sys.path)
# Add project base directory and vendor-lib to sys.path (using
# site.addsitedir for the latter so pth files are processed)
site.addsitedir(vendor_lib)
# Give new entries precedence over global Python environment
new_sys_path = []
for item in list(sys.path):
if item not in orig_sys_path:
new_sys_path.append(item)
sys.path.remove(item)
sys.path[:0] = new_sys_path

Просмотреть файл

@ -1,26 +1,11 @@
# A WSGI entry-point that uses requirements/vendor for dependencies. # A WSGI entry-point that uses requirements/vendor for dependencies.
import os, sys
import os, sys, site
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
vendor_lib = os.path.join(base_dir, "requirements", "vendor", "lib", "python") sys.path.insert(0, base_dir)
orig_sys_path = set(sys.path)
# Add project base directory and vendor-lib to sys.path (using site.addsitedir
# for the latter so pth files are processed)
sys.path.append(base_dir)
site.addsitedir(vendor_lib)
# Give new entries precedence over global Python environment
new_sys_path = []
for item in list(sys.path):
if item not in orig_sys_path:
new_sys_path.append(item)
sys.path.remove(item)
sys.path[:0] = new_sys_path
from deploy.paths import add_vendor_lib
add_vendor_lib()
# Set default settings and instantiate application # Set default settings and instantiate application

35
manage-vendor.py Executable file
Просмотреть файл

@ -0,0 +1,35 @@
#!/usr/bin/env python
# Case Conductor is a Test Case Management system.
# Copyright (C) 2011 uTest Inc.
#
# This file is part of Case Conductor.
#
# Case Conductor is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Case Conductor is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Case Conductor. If not, see <http://www.gnu.org/licenses/>.
"""
Runs a Django management command, using the vendor library.
"""
import os, sys
from deploy.paths import add_vendor_lib
if __name__ == "__main__":
add_vendor_lib()
os.environ["DJANGO_SETTINGS_MODULE"] = "ccui.settings.default"
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)