本文整理汇总了Python中sipconfig.inform函数的典型用法代码示例。如果您正苦于以下问题:Python inform函数的具体用法?Python inform怎么用?Python inform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了inform函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_makefiles
def create_makefiles():
"""Create the additional Makefiles.
"""
sipconfig.inform("Creating top level Makefile...")
sipconfig.ParentMakefile(
configuration=pyqtcfg, subdirs=["qmmp"], installs=("pyqmmpconfig.py", opt_pyqmmpmoddir)
).generate()
示例2: manage_cache
def manage_cache(gendir):
"""
This function keeps a cache of all sip-generated *.cpp and *.h files
and restores the stats of the newly generated set whenever the content
is unchanged
"""
sipconfig.inform("Managing the module cache: %s" % gendir)
gendir = path(gendir)
cache = gendir / 'cache'
cache.ensure_exists()
if 'clean' in sys.argv:
cache.rmtree()
changed_count = 0
for newfile in gendir.files('*.cpp') + gendir.files('*.h'):
oldfile = cache / newfile.name
if different(newfile, oldfile):
changed_count += 1
shutil.copy2(newfile, oldfile)
if VERBOSE:
sipconfig.inform("--> changed: %s" % newfile.name)
else:
#sipconfig.inform("--> same: %s" % newfile.name)
shutil.copystat(oldfile, newfile)
sipconfig.inform('%d file%s changed.' %
(changed_count, 's' if changed_count != 1 else ''))
示例3: create_config
def create_config(module, template):
"""Create the PyQMMP configuration module so that it can be imported
by build scripts.
module is the module file name.
template is the template file name.
"""
sipconfig.inform("Creating %s..." % module)
content = {
"pyqmmp_version": pyqmmp_version,
"pyqmmp_version_str": pyqmmp_version_str,
"pyqmmp_mod_dir": opt_pyqmmpmoddir,
"pyqmmp_sip_dir": opt_pyqmmpsipdir,
"pyqmmp_qmmp_sip_flags": qmmp_sip_flags,
# These are internal.
"_pyqmmp_defines": qmmp_define,
"_pyqmmp_inc_dir": opt_qmmpincdir,
"_pyqmmp_lib_dir": opt_qmmplibdir,
}
sipconfig.create_config_module(module, template, content)
示例4: check_qscintilla
def check_qscintilla():
"""See if QScintilla can be found and what its version is.
"""
# Find the QScintilla header files.
sciglobal = os.path.join(opts.qsciincdir, "Qsci", "qsciglobal.h")
if os.access(sciglobal, os.F_OK):
# Get the QScintilla version string.
_, sciversstr = sipconfig.read_version(sciglobal, "QScintilla", "QSCINTILLA_VERSION", "QSCINTILLA_VERSION_STR")
if glob.glob(os.path.join(opts.qscilibdir, "*qscintilla2*")):
# Because we include the Python bindings with the C++ code we can
# reasonably force the same version to be used and not bother about
# versioning.
if sciversstr != "2.9.1":
sipconfig.error("QScintilla %s is being used but the Python bindings 2.9.1 are being built. Please use matching versions." % sciversstr)
sipconfig.inform("QScintilla %s is being used." % sciversstr)
else:
sipconfig.error("The QScintilla library could not be found in %s. If QScintilla is installed then use the -o argument to explicitly specify the correct directory." % opts.qscilibdir)
else:
sipconfig.error("Qsci/qsciglobal.h could not be found in %s. If QScintilla is installed then use the -n argument to explicitly specify the correct directory." % opts.qsciincdir)
示例5: generate_code
def generate_code(self, config):
sip_install_dir = os.path.join(config.default_sip_dir, "skia")
module_install_dir = os.path.join(config.default_mod_dir, "skia")
for module in self.MODULES:
# Calculate SIP module folder and scan for .sip files
module_dir = os.path.join(self.SIP_DIR, module)
sipconfig.inform("Processing {}...".format(module_dir))
# Calculate module paths
sip_file = os.path.join(module_dir, "{}.sip".format(module))
build_dir = os.path.join(self.BUILD_DIR, module)
build_file = os.path.join(build_dir, "{}.sbf".format(module))
# Creating paths
if not os.path.exists(build_dir):
os.makedirs(build_dir)
# Execute 'sip' command
cmd = [
config.sip_bin,
"-c", build_dir,
"-b", build_file,
sip_file
]
if subprocess.call(cmd):
sipconfig.error(sip_file)
sys.exit(1)
# Generate module Makefile
sipconfig.inform("Generating Makefile for '{}'...".format(module))
makefile = sipconfig.SIPModuleMakefile(
config,
build_file,
dir=build_dir,
install_dir=module_install_dir,
installs=[(sip_file, os.path.join(sip_install_dir, module))],
makefile=os.path.join(build_dir, "Makefile")
)
makefile.extra_lib_dirs = [config.skia_libs_dir]
makefile.extra_include_dirs = config.skia_includes
makefile.extra_libs = config.skia_libs
makefile.extra_lflags = ["-framework ApplicationServices"]
makefile.generate()
# Generate parent Makefile
sipconfig.inform("Generating main Makefile...")
sipconfig.ParentMakefile(
configuration=config,
subdirs=[os.path.join(self.BUILD_DIR, m) for m in self.MODULES],
installs=[(f, config.skia_mod_dir) for f in self.package_installs],
).generate()
示例6: create_makefiles
def create_makefiles(macros):
"""Create the Makefiles.
macros is the dictionary of platform specific build macros.
"""
# Bootstrap. Make sure we get the right one.
sys.path.insert(0, os.path.curdir)
invalidate_caches()
import sipconfig
cfg = sipconfig.Configuration()
cfg.set_build_macros(macros)
sipconfig.inform("Creating top level Makefile...")
sipconfig.ParentMakefile(
configuration=cfg,
subdirs=["sipgen", "siplib"],
installs=(["sipconfig.py", os.path.join(src_dir, "sipdistutils.py")],
cfg.sip_mod_dir)
).generate()
sipconfig.inform("Creating sip code generator Makefile...")
sipconfig.ProgramMakefile(
configuration=cfg,
build_file=os.path.join(src_dir, "sipgen", "sipgen.sbf"),
dir="sipgen",
install_dir=os.path.dirname(cfg.sip_bin),
console=1,
warnings=0,
universal=opts.universal,
arch=opts.arch,
deployment_target=opts.deployment_target
).generate()
sipconfig.inform("Creating sip module Makefile...")
makefile = sipconfig.ModuleMakefile(
configuration=cfg,
build_file=os.path.join(src_dir, "siplib", "siplib.sbf"),
dir="siplib",
install_dir=cfg.sip_mod_dir,
installs=([os.path.join(src_dir, "siplib", "sip.h")], cfg.sip_inc_dir),
console=1,
warnings=0,
static=opts.static,
debug=opts.debug,
universal=opts.universal,
arch=opts.arch,
deployment_target=opts.deployment_target
)
makefile.generate()
示例7: create_makefiles
def create_makefiles(macros):
"""Create the Makefiles.
macros is the dictionary of platform specific build macros.
"""
# Bootstrap.
import sipconfig
cfg = sipconfig.Configuration()
cfg.set_build_macros(macros)
sipconfig.inform("Creating top level Makefile...")
sipconfig.ParentMakefile(
configuration=cfg,
subdirs=["sipgen", "siplib"],
installs=(["sipconfig.py", "sipdistutils.py"], cfg.sip_mod_dir)
).generate()
sipconfig.inform("Creating sip code generator Makefile...")
sipconfig.ProgramMakefile(
configuration=cfg,
build_file="sipgen.sbf",
dir="sipgen",
install_dir=os.path.dirname(cfg.sip_bin),
console=1,
warnings=0,
universal=opts.universal
).generate()
sipconfig.inform("Creating sip module Makefile...")
makefile = sipconfig.ModuleMakefile(
configuration=cfg,
build_file="siplib.sbf",
dir="siplib",
install_dir=cfg.sip_mod_dir,
installs=(["sip.h"], cfg.sip_inc_dir),
console=1,
warnings=0,
static=opts.static,
debug=opts.debug,
universal=opts.universal
)
makefile.generate()
示例8: manage_cache
def manage_cache(gendir, show_diffs = True):
"""
This function keeps a cache of all sip-generated *.cpp and *.h files
and restores the stats of the newly generated set whenever the content
is unchanged
"""
sipconfig.inform("Managing the module cache: %s" % gendir)
gendir = path(gendir)
cache = gendir / 'cache'
if not cache.isdir():
cache.makedirs()
if 'clean' in sys.argv:
cache.rmtree()
changed_count = 0
for newfile in gendir.files('*.cpp') + gendir.files('*.h'):
oldfile = cache / newfile.name
if different(newfile, oldfile):
changed_count += 1
if oldfile.isfile():
assert newfile.mtime > oldfile.mtime
shutil.copy2(newfile, oldfile) # src, dest
a, b = newfile.stat().st_mtime, oldfile.stat().st_mtime
#assert a == b, "copy2 failed: mtimes are different! (%s and %s)" % (a, b)
sipconfig.inform("--> changed: %s" % newfile.name)
else:
#sipconfig.inform("--> same: %s" % newfile.name)
shutil.copystat(oldfile, newfile)
sipconfig.inform('%d file%s changed.' %
(changed_count, 's' if changed_count != 1 else ''))
sys.stdout.flush()
示例9: inform_user
def inform_user():
"""Tell the user the option values that are going to be used.
"""
sipconfig.inform("PyQt %s is being used." % pyqt.pyqt_version_str)
sipconfig.inform("Qt v%s %s edition is being used." % (sipconfig.version_to_string(pyqt.qt_version), pyqt.qt_edition))
sipconfig.inform("SIP %s is being used." % pyqt.sip_version_str)
sipconfig.inform("The Fresh module will be installed in %s." % opts.freshmoddir)
sipconfig.inform("The Fresh API file will be installed in %s." % os.path.join(opts.freshdir, "api", "python"))
sipconfig.inform("The Fresh .sip files will be installed in %s." % opts.freshsipdir)
if opts.no_docstrings:
sipconfig.inform("The Fresh module is being built without generated docstrings.")
else:
sipconfig.inform("The Fresh module is being built with generated docstrings.")
示例10: inform_user
def inform_user():
"""Tell the user the option values that are going to be used.
"""
sipconfig.inform("The PyQMMP modules will be installed in %s." % opt_pyqmmpmoddir)
sipconfig.inform("The PyQMMP .sip files will be installed in %s." % opt_pyqmmpsipdir)
示例11: main
def main(argv):
"""Create the configuration module module.
argv is the list of command line arguments.
"""
try:
optlist, args = getopt.getopt(argv[1:], "hcd:gj:kn:o:ruv:w")
except getopt.GetoptError:
usage()
global opt_pyqmmpmoddir, opt_pyqmmpsipdir
global opt_qmmpincdir, opt_qmmplibdir
global opt_static, opt_debug, opt_concat, opt_releasegil, opt_split
global opt_tracing, opt_verbose
"""
for opt, arg in optlist:
if opt == "-h":
usage(0)
elif opt == "-c":
opt_concat = 1
elif opt == "-d":
opt_pyqmmpmoddir = arg
elif opt == "-g":
opt_releasegil = 1
elif opt == "-j":
try:
opt_split = int(arg)
except:
usage()
elif opt == "-k":
opt_static = 1
elif opt == "-n":
opt_qmmpincdir = arg
elif opt == "-o":
opt_qmmplibdir = arg
elif opt == "-r":
opt_tracing = 1
elif opt == "-u":
opt_debug = 1
elif opt == "-v":
opt_pyqmmpsipdir = arg
elif opt == "-w":
opt_verbose = 1
if args:
usage()
"""
# check_license()
sipconfig.inform("SIP %s is being used." % pyqtcfg.sip_version_str)
# Check SIP is new enough.
if pyqtcfg.sip_version_str[:8] != "snapshot":
minv = None
if pyqtcfg.sip_version >= 0x040000:
if pyqtcfg.sip_version < sip_min_v4_version:
minv = sip_min_v4_version
else:
if pyqtcfg.sip_version < sip_min_v3_version:
minv = sip_min_v3_version
if minv:
sipconfig.error("This version of PyQMMP requires SIP v%s or later" % sipconfig.version_to_string(minv))
# Check for .
# check_qmmp()
# If wasn't found then there is no point carrying on. An
# appropriate error message will already have been displayed.
# if qmmp_version is None:
# sys.exit(1)
# Set the SIP platform, version and feature flags.
set_sip_flags()
# Tell the user what's been found.
inform_user()
lib_dir = "../../"
# if opt_qmmplibdir != "../lib":
# lib_dir = opt_qmmplibdir
# Generate the code.
generate_code(
"qmmp",
imports=["PyQt4"],
extra_define=qmmp_define,
extra_include_dir=opt_qmmpincdir,
extra_lib_dir=lib_dir,
extra_lib="qmmp",
sip_flags=qmmp_sip_flags,
)
# Create the additional Makefiles.
create_makefiles()
# Install the configuration module.
#.........这里部分代码省略.........
示例12: generate_code
def generate_code():
"""Generate the code for the Fresh module.
"""
mname = "fresh"
sipconfig.inform("Generating the C++ source for the %s module..." % mname)
# Build the SIP command line.
argv = ['"' + pyqt.sip_bin + '"']
argv.extend(sip_flags())
if not opts.no_docstrings:
argv.append("-o");
if opts.concat:
argv.append("-j")
argv.append(str(opts.split))
if opts.tracing:
argv.append("-r")
argv.append("-c")
argv.append(".")
buildfile = os.path.join("fresh.sbf")
argv.append("-b")
argv.append(buildfile)
if pyqt.pyqt_version >= 0x040000:
argv.append("../Python/sip/fresh.sip")
os.system(" ".join(argv))
# Check the result.
if not os.access(buildfile, os.F_OK):
sipconfig.error("Unable to create the C++ code.")
# Generate the Makefile.
sipconfig.inform("Creating the Makefile for the %s module..." % mname)
def fix_install(mfile):
if sys.platform != "darwin" or opts.static:
return
mfile.write("\tinstall_name_tool -change libqscintilla2.%u.dylib %s/libqscintilla2.%u.dylib $(DESTDIR)%s/$(TARGET)\n" % (FRESH_API_MAJOR, opts.freshlibdir, FRESH_API_MAJOR, opts.freshmoddir))
if pyqt.pyqt_version >= 0x040000:
class Makefile(pyqt4.QtGuiModuleMakefile):
def generate_target_install(self, mfile):
pyqt4.QtGuiModuleMakefile.generate_target_install(self, mfile)
fix_install(mfile)
else:
class Makefile(pyqt3.QtModuleMakefile):
def generate_target_install(self, mfile):
pyqt3.QtModuleMakefile.generate_target_install(self, mfile)
fix_install(mfile)
installs = []
sipfiles = []
for s in glob.glob("sip/*.sip"):
sipfiles.append(os.path.join("sip", os.path.basename(s)))
installs.append([sipfiles, os.path.join(opts.freshsipdir, mname)])
installs.append(("fresh.api", os.path.join(opts.freshdir, "api", "python")))
makefile = Makefile(
configuration=pyqt,
build_file="fresh.sbf",
install_dir=opts.freshmoddir,
installs=installs,
static=opts.static,
debug=opts.debug,
universal=pyqt.universal)
if fresh_define:
makefile.extra_defines.append(fresh_define)
makefile.extra_include_dirs.append('..')
makefile.extra_include_dirs.append(opts.freshincdir)
makefile.extra_lib_dirs.append(opts.freshlibdir)
makefile.extra_lib_dirs.append('../build')
makefile.extra_libs.append("cppfresh")
makefile.generate()
示例13: check_license
def check_license():
"""Handle the validation of the PyQMMP license.
"""
try:
import license
ltype = license.LicenseType
lname = license.LicenseName
try:
lfile = license.LicenseFile
except AttributeError:
lfile = None
except ImportError:
ltype = None
if ltype is None:
ltype = "GPL"
lname = "GNU General Public License"
lfile = None
sipconfig.inform(
"This is the %s version of PyQMMP %s (licensed under the %s) for Python %s on %s."
% (ltype, pyqmmp_version_str, lname, string.split(sys.version)[0], sys.platform)
)
# Common checks.
if ltype == "GPL" and sys.platform == "win32":
error("You cannot use the GPL version of PyQMMP under Windows.")
try:
qted = pyqtcfg.qt_edition
except AttributeError:
qted = None
if qted:
if (qted == "free" and ltype != "GPL") or (qted != "free" and ltype == "GPL"):
sipconfig.error("This version of PyQMMP and the %s edition of Qt have incompatible licenses." % qted)
# Confirm the license.
print
print "Type 'L' to view the license."
print "Type 'yes' to accept the terms of the license."
print "Type 'no' to decline the terms of the license."
print
while 1:
try:
resp = raw_input("Do you accept the terms of the license? ")
except:
resp = ""
resp = string.lower(string.strip(resp))
if resp == "yes":
break
if resp == "no":
sys.exit(0)
if resp == "l":
os.system("more LICENSE")
# If there should be a license file then check it is where it should be.
if lfile:
if os.access(os.path.join("sip", lfile), os.F_OK):
sipconfig.inform("Found the license file %s." % lfile)
else:
sipconfig.error("Please copy the license file %s to the sip directory." % lfile)
示例14: build_file
return params
def build_file():
return os.path.join(options.build_path, "%s.sbf" % options.module_name)
def parse_options():
from optparse import OptionParser
parser = OptionParser()
parser.add_option("", "--module-name", dest="module_name", help="the python module name of the lib")
parser.add_option("", "--sip-file", dest="sip_file", help="the sip file of the lib")
parser.add_option("", "--lib", dest="lib", help="the name without extension of the lib")
parser.add_option("", "--lib-path", dest="lib_path", help="the path where the lib dynamic library can be found")
parser.add_option("", "--include-path", dest="include_path", help="the path where the lib headers can be found")
parser.add_option("", "--build-path", dest="build_path", help="the path where the Makefile can be found")
options, args = parser.parse_args()
return options
options = None
if __name__ == '__main__':
options = parse_options()
config = pyqtconfig.Configuration()
sipconfig.inform("Generating bindings")
run_sip(config)
sipconfig.inform("Generating Makefile")
generate_makefile(config)
sipconfig.inform("Makefile generated. Run \"nmake\" now.")
示例15: inform_user
def inform_user():
"""Tell the user the option values that are going to be used.
"""
sipconfig.inform("PyQt %s is being used." % pyqt.pyqt_version_str)
sipconfig.inform("Qt v%s %s edition is being used." % (sipconfig.version_to_string(pyqt.qt_version), pyqt.qt_edition))
sipconfig.inform("SIP %s is being used." % pyqt.sip_version_str)
sipconfig.inform("The QScintilla module will be installed in %s." % opts.qscimoddir)
sipconfig.inform("The QScintilla API file will be installed in %s." % os.path.join(opts.qscidir, "api", "python"))
sipconfig.inform("The QScintilla .sip files will be installed in %s." % opts.qscisipdir)
if opts.no_docstrings:
sipconfig.inform("The QScintilla module is being built without generated docstrings.")
else:
sipconfig.inform("The QScintilla module is being built with generated docstrings.")
if opts.prot_is_public:
sipconfig.inform("The QScintilla module is being built with 'protected' redefined as 'public'.")