Browse Source

Add a customizable import config file.

pull/24/head
Ben Kurtovic 12 years ago
parent
commit
8565a19fc2
3 changed files with 45 additions and 10 deletions
  1. +8
    -2
      .gitignore
  2. +5
    -8
      build.py
  3. +32
    -0
      toolserver/preconfig.py.ts

+ 8
- 2
.gitignore View File

@@ -1,5 +1,11 @@
*.pyc *.pyc
temp/
www/
*.egg
*.egg-info
.DS_Store
__pycache__

temp
www
.earwigbot .earwigbot
rewrite.script rewrite.script
toolserver/preconfig.py

+ 5
- 8
build.py View File

@@ -9,19 +9,16 @@ import subprocess
page_src = """#! /usr/bin/env python page_src = """#! /usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import site
import sys import sys


os.chdir("..") os.chdir("..")
plat = sys.platform
if plat.startswith("sunos"):
plat = "solaris"
elif plat.startswith("linux"):
plat = "linux"
site.addsitedir(os.path.expanduser("~/.local/" + plat + "/lib/python2.7/site-packages"))
sys.path.insert(0, os.path.expanduser("~/.local/" + plat + "/lib/python2.7/site-packages"))
sys.path.insert(0, ".") sys.path.insert(0, ".")


try:
from toolserver import preconfig
except ImportError:
pass

from mako.template import Template from mako.template import Template
from mako.lookup import TemplateLookup from mako.lookup import TemplateLookup




+ 32
- 0
toolserver/preconfig.py.ts View File

@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-

"""
This module contains installation-specific import configuration for the
Toolserver. To add your own, create and put code in the file 'preconfig.py' in
this directory, or rename this file to 'preconfig.py' if you want to use this
specific configuration.
"""

import os
import site
import sys

# Add a local platform-specific site package directory:

plat = sys.platform
if plat.startswith("sunos"):
plat = "solaris"
elif plat.startswith("linux"):
plat = "linux"

site.addsitedir(os.path.expanduser("~/.local/" + plat + "/lib/python2.7/site-packages"))
sys.path.insert(0, os.path.expanduser("~/.local/" + plat + "/lib/python2.7/site-packages"))

# EarwigBot, in-between releases, tries to import the 'git' module and add the
# current git commit ID to its __version__ string. This behavior is useful, but
# the Toolserver can be slow at importing things. Insert a fake 'git' module
# into sys.modules so it skips the __version__ addition:

from types import ModuleType
git = ModuleType("git")
sys.modules["git"] = git

Loading…
Cancel
Save