Added manage-vendor.py
This commit is contained in:
Родитель
da5f7fa0e6
Коммит
65dd84bf04
|
@ -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.
|
||||
|
||||
import os, sys, site
|
||||
import os, sys
|
||||
|
||||
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)
|
||||
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
|
||||
sys.path.insert(0, base_dir)
|
||||
|
||||
from deploy.paths import add_vendor_lib
|
||||
add_vendor_lib()
|
||||
|
||||
# Set default settings and instantiate application
|
||||
|
||||
|
|
|
@ -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)
|
Загрузка…
Ссылка в новой задаче