Moved all wrap related things to their own submodule.

pull/356/head
Jussi Pakkanen 9 years ago
parent 4c31e7774d
commit ec44795f8a
  1. 2
      meson/interpreter.py
  2. 0
      meson/modules/__init__.py
  3. 10
      meson/wrap/wrap.py
  4. 38
      meson/wrap/wraptool.py
  5. 20
      wraptool

@ -19,7 +19,7 @@ from . import dependencies
from . import mlog
from . import build
from . import optinterpreter
from . import wrap
from .wrap import wrap
from . import mesonlib
import os, sys, platform, subprocess, shutil, uuid, re

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from . import mlog
from .. import mlog
import urllib.request, os, hashlib, shutil
import subprocess
import sys
@ -25,6 +25,14 @@ except ImportError:
has_ssl = False
API_ROOT = 'http://wrapdb.mesonbuild.com/v1/'
def build_ssl_context():
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
ctx.options |= ssl.OP_NO_SSLv2
ctx.options |= ssl.OP_NO_SSLv3
ctx.verify_mode = ssl.CERT_REQUIRED
ctx.load_default_certs()
return ctx
def open_wrapdburl(urlstring):
global ssl_warning_printed
if has_ssl:

@ -1,6 +1,6 @@
#!/usr/bin/env python3
# Copyright 2015 The Meson development team
# Copyright 2015-2016 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -19,11 +19,10 @@ import sys, os
import configparser
import shutil
ssl_warning_printed = False
from glob import glob
from .wrap import API_ROOT, open_wrapdburl
help_templ = '''This program allows you to manage your Wrap dependencies
using the online wrap database http://wrapdb.mesonbuild.com.
@ -48,14 +47,6 @@ Commands:
def print_help():
print(help_templ % sys.argv[0])
def build_ssl_context():
ctx = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
ctx.options |= ssl.OP_NO_SSLv2
ctx.options |= ssl.OP_NO_SSLv3
ctx.verify_mode = ssl.CERT_REQUIRED
ctx.load_default_certs()
return ctx
def get_result(urlstring):
u = open_wrapdburl(urlstring)
data = u.read().decode('utf-8')
@ -170,37 +161,40 @@ def status():
else:
print('', name, 'not up to date. Have %s %d, but %s %d is available.' % (current_branch, current_revision, latest_branch, latest_revision))
if __name__ == '__main__':
if len(sys.argv) < 2 or sys.argv[1] == '-h' or sys.argv[1] == '--help':
def run(args):
if len(sys.argv) < 1 or sys.argv[0] == '-h' or sys.argv[1] == '--help':
print_help()
sys.exit(0)
command = sys.argv[1]
args = sys.argv[2:]
return 0
command = args[0]
args = args[1:]
if command == 'list':
list_projects()
elif command == 'search':
if len(args) != 1:
print('Search requires exactly one argument.')
sys.exit(1)
return 1
search(args[0])
elif command == 'install':
if len(args) != 1:
print('Install requires exactly one argument.')
sys.exit(1)
return 1
install(args[0])
elif command == 'update':
if len(args) != 1:
print('update requires exactly one argument.')
sys.exit(1)
return 1
update(args[0])
elif command == 'info':
if len(args) != 1:
print('info requires exactly one argument.')
sys.exit(1)
return 1
info(args[0])
elif command == 'status':
status()
else:
print('Unknown command', command)
sys.exit(1)
return 1
return 0
if __name__ == '__main__':
sys.exit(run(sys.argv[1:]))

@ -0,0 +1,20 @@
#!/usr/bin/env python3
# Copyright 2016 The Meson development team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from meson.wrap import wraptool
import sys
sys.exit(wraptool.run(sys.argv[1:]))
Loading…
Cancel
Save