def install_data(d): for i in d.data: fullfilename = i[0] outfilename = i[1] if os.path.isabs(outfilename): outdir = destdir_join(d.destdir, os.path.split(outfilename)[0]) outfilename = destdir_join(d.destdir, outfilename) else: outdir = os.path.join(d.fullprefix, os.path.split(outfilename)[0]) outfilename = os.path.join(outdir, os.path.split(outfilename)[1]) os.makedirs(outdir, exist_ok=True) print('Installing %s to %s.' % (fullfilename, outdir)) do_copy(fullfilename, outfilename)
def run(args): options = parser.parse_args(args) subcmd = options.command langs = options.langs.split('@@') extra_args = options.extra_args.split('@@') subdir = os.environ.get('MESON_SUBDIR', options.subdir) src_sub = os.path.join(os.environ['MESON_SOURCE_ROOT'], subdir) bld_sub = os.path.join(os.environ['MESON_BUILD_ROOT'], subdir) if subcmd == 'pot': return run_potgen(src_sub, options.pkgname, options.datadirs, extra_args) elif subcmd == 'gen_gmo': return gen_gmo(src_sub, bld_sub, langs) elif subcmd == 'update_po': if run_potgen(src_sub, options.pkgname, options.datadirs, extra_args) != 0: return 1 return update_po(src_sub, options.pkgname, langs) elif subcmd == 'install': destdir = os.environ.get('DESTDIR', '') dest = destdir_join( destdir, os.path.join(os.environ['MESON_INSTALL_PREFIX'], options.localedir)) if gen_gmo(src_sub, bld_sub, langs) != 0: return 1 do_install(src_sub, bld_sub, dest, options.pkgname, langs) else: print('Unknown subcommand.') return 1
def run(args): subcmd = args[0] if subcmd == 'pot': src_sub = os.path.join(os.environ['MESON_SOURCE_ROOT'], os.environ['MESON_SUBDIR']) bld_sub = os.path.join(os.environ['MESON_BUILD_ROOT'], os.environ['MESON_SUBDIR']) return run_potgen(src_sub, args[1], args[2:]) elif subcmd == 'gen_gmo': src_sub = os.path.join(os.environ['MESON_SOURCE_ROOT'], os.environ['MESON_SUBDIR']) bld_sub = os.path.join(os.environ['MESON_BUILD_ROOT'], os.environ['MESON_SUBDIR']) return gen_gmo(src_sub, bld_sub, args[1:]) elif subcmd == 'install': subdir = args[1] pkgname = args[2] instsubdir = args[3] langs = args[4:] src_sub = os.path.join(os.environ['MESON_SOURCE_ROOT'], subdir) bld_sub = os.path.join(os.environ['MESON_BUILD_ROOT'], subdir) destdir = os.environ.get('DESTDIR', '') dest = destdir_join(destdir, os.path.join(os.environ['MESON_INSTALL_PREFIX'], instsubdir)) if gen_gmo(src_sub, bld_sub, langs) != 0: return 1 do_install(src_sub, bld_sub, dest, pkgname, langs) else: print('Unknown subcommand.') return 1
def run(args): options = parser.parse_args(args) if len(options.htmlargs) > 0: htmlargs = options.htmlargs.split('@@') else: htmlargs = [] if len(options.scanargs) > 0: scanargs = options.scanargs.split('@@') else: scanargs = [] if len(options.scanobjsargs) > 0: scanobjsargs = options.scanobjsargs.split('@@') else: scanobjsargs = [] if len(options.fixxrefargs) > 0: fixxrefargs = options.fixxrefargs.split('@@') else: fixxrefargs = [] build_gtkdoc( options.sourcedir, options.builddir, options.subdir, options.headerdir, options.mainfile, options.modulename, htmlargs, scanargs, fixxrefargs, options.gobject_typesfile, scanobjsargs, options.ld, options.cc, options.ldflags, options.cflags, options.html_assets.split('@@') if options.html_assets else [], options.content_files.split('@@') if options.content_files else [], options.ignore_headers.split('@@') if options.ignore_headers else []) if 'MESON_INSTALL_PREFIX' in os.environ: install_dir = options.install_dir if options.install_dir else options.modulename destdir = os.environ.get('DESTDIR', '') installdir = destdir_join(destdir, os.environ['MESON_INSTALL_PREFIX']) install_gtkdoc(options.builddir, options.subdir, installdir, 'share/gtk-doc/html', install_dir) return 0
def run(args): options = parser.parse_args(args) if len(options.htmlargs) > 0: htmlargs = options.htmlargs.split('@@') else: htmlargs = [] if len(options.scanargs) > 0: scanargs = options.scanargs.split('@@') else: scanargs = [] if len(options.fixxrefargs) > 0: fixxrefargs = options.fixxrefargs.split('@@') else: fixxrefargs = [] build_gtkdoc(options.sourcedir, options.builddir, options.subdir, options.headerdir, options.mainfile, options.modulename, htmlargs, scanargs, fixxrefargs) if 'MESON_INSTALL_PREFIX' in os.environ: destdir = os.environ.get('DESTDIR', '') installdir = destdir_join(destdir, os.environ['MESON_INSTALL_PREFIX']) install_gtkdoc(options.builddir, options.subdir, installdir, 'share/gtk-doc/html', options.modulename) return 0
def install_help(srcdir, blddir, sources, media, langs, install_dir, destdir, project_id, symlinks): c_install_dir = os.path.join(install_dir, 'C', project_id) for lang in langs + ['C']: indir = destdir_join(destdir, os.path.join(install_dir, lang, project_id)) os.makedirs(indir, exist_ok=True) for source in sources: infile = os.path.join(srcdir if lang == 'C' else blddir, lang, source) outfile = os.path.join(indir, source) mlog.log('Installing %s to %s.' % (infile, outfile)) shutil.copyfile(infile, outfile) shutil.copystat(infile, outfile) for m in media: infile = os.path.join(srcdir, lang, m) outfile = os.path.join(indir, m) if not os.path.exists(infile): if lang == 'C': mlog.warning( 'Media file "%s" did not exist in C directory' % m) elif symlinks: srcfile = os.path.join(c_install_dir, m) mlog.log('Symlinking %s to %s.' % (outfile, srcfile)) if '/' in m or '\\' in m: os.makedirs(os.path.dirname(outfile), exist_ok=True) os.symlink(srcfile, outfile) continue symfile = os.path.join(install_dir, m) mlog.log('Installing %s to %s.' % (infile, outfile)) if '/' in m or '\\' in m: os.makedirs(os.path.dirname(outfile), exist_ok=True) shutil.copyfile(infile, outfile) shutil.copystat(infile, outfile)
def do_install(datafilename): ifile = open(datafilename, 'rb') d = pickle.load(ifile) d.destdir = os.environ.get('DESTDIR', '') d.fullprefix = destdir_join(d.destdir, d.prefix) install_subdirs(d) # Must be first, because it needs to delete the old subtree. install_targets(d) install_headers(d) install_man(d) install_data(d) run_install_script(d)
def do_install(datafilename): with open(datafilename, 'rb') as ifile: d = pickle.load(ifile) d.destdir = os.environ.get('DESTDIR', '') d.fullprefix = destdir_join(d.destdir, d.prefix) install_subdirs(d) # Must be first, because it needs to delete the old subtree. install_targets(d) install_headers(d) install_man(d) install_data(d) run_install_script(d)
def install_subdirs(data): for (src_dir, inst_dir, dst_dir) in data.install_subdirs: if src_dir.endswith('/') or src_dir.endswith('\\'): src_dir = src_dir[:-1] src_prefix = os.path.join(src_dir, inst_dir) print('Installing subdir %s to %s.' % (src_prefix, dst_dir)) if os.path.isabs(dst_dir): dst_dir = destdir_join(data.destdir, dst_dir) else: dst_dir = data.fullprefix + dst_dir if not os.path.exists(dst_dir): os.makedirs(dst_dir) for root, dirs, files in os.walk(src_prefix): for d in dirs: abs_src = os.path.join(src_dir, root, d) filepart = abs_src[len(src_dir)+1:] abs_dst = os.path.join(dst_dir, filepart) if os.path.isdir(abs_dst): continue if os.path.exists(abs_dst): print('Tried to copy directory %s but a file of that name already exists.' % abs_dst) sys.exit(1) os.makedirs(abs_dst) shutil.copystat(abs_src, abs_dst) for f in files: abs_src = os.path.join(src_dir, root, f) filepart = abs_src[len(src_dir)+1:] abs_dst = os.path.join(dst_dir, filepart) if os.path.isdir(abs_dst): print('Tried to copy file %s but a directory of that name already exists.' % abs_dst) if os.path.exists(abs_dst): os.unlink(abs_dst) parent_dir = os.path.split(abs_dst)[0] if not os.path.isdir(parent_dir): os.mkdir(parent_dir) shutil.copystat(os.path.split(abs_src)[0], parent_dir) shutil.copy2(abs_src, abs_dst, follow_symlinks=False) append_to_log(abs_dst)
def get_destdir_path(d, path): if os.path.isabs(path): output = destdir_join(d.destdir, path) else: output = os.path.join(d.fullprefix, path) return output