thirdparty/google_appengine/appcfg.py
changeset 149 f2e327a7c5de
parent 109 620f9b141567
child 828 f5fd65cc3bf3
equal deleted inserted replaced
148:37505d64e57b 149:f2e327a7c5de
    12 # distributed under the License is distributed on an "AS IS" BASIS,
    12 # distributed under the License is distributed on an "AS IS" BASIS,
    13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    14 # See the License for the specific language governing permissions and
    14 # See the License for the specific language governing permissions and
    15 # limitations under the License.
    15 # limitations under the License.
    16 #
    16 #
    17 """Convenience wrapper for starting appcfg."""
    17 """Convenience wrapper for starting an appengine tool."""
    18 
    18 
    19 
    19 
    20 import os
    20 import os
    21 import sys
    21 import sys
    22 
    22 
    31   sys.exit(1)
    31   sys.exit(1)
    32 if version_tuple == (2, 4):
    32 if version_tuple == (2, 4):
    33   sys.stderr.write('Warning: Python 2.4 is not supported; this program may '
    33   sys.stderr.write('Warning: Python 2.4 is not supported; this program may '
    34                    'break. Please use version 2.5 or greater.\n')
    34                    'break. Please use version 2.5 or greater.\n')
    35 
    35 
    36 APPCFG_PATH = 'google/appengine/tools/appcfg.py'
       
    37 
       
    38 DIR_PATH = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
    36 DIR_PATH = os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
       
    37 SCRIPT_DIR = os.path.join(DIR_PATH, 'google', 'appengine', 'tools')
    39 
    38 
    40 EXTRA_PATHS = [
    39 EXTRA_PATHS = [
    41   DIR_PATH,
    40   DIR_PATH,
       
    41   os.path.join(DIR_PATH, 'lib', 'django'),
       
    42   os.path.join(DIR_PATH, 'lib', 'webob'),
    42   os.path.join(DIR_PATH, 'lib', 'yaml', 'lib'),
    43   os.path.join(DIR_PATH, 'lib', 'yaml', 'lib'),
    43 ]
    44 ]
    44 
    45 
       
    46 SCRIPT_EXCEPTIONS = {
       
    47   "dev_appserver.py" : "dev_appserver_main.py"
       
    48 }
       
    49 
    45 if __name__ == '__main__':
    50 if __name__ == '__main__':
    46   sys.path = EXTRA_PATHS + sys.path
    51   sys.path = EXTRA_PATHS + sys.path
    47   script_path = os.path.join(DIR_PATH, APPCFG_PATH)
    52   script_name = os.path.basename(__file__)
       
    53   script_name = SCRIPT_EXCEPTIONS.get(script_name, script_name)
       
    54   script_path = os.path.join(SCRIPT_DIR, script_name)
    48   execfile(script_path, globals())
    55   execfile(script_path, globals())