Ejemplo n.º 1
0
def install_qt():
    # qt
    if not base.is_file("./qt_source_5.9.9.tar.xz"):
        base.download(
            "https://download.qt.io/archive/qt/5.9/5.9.9/single/qt-everywhere-opensource-src-5.9.9.tar.xz",
            "./qt_source_5.9.9.tar.xz")

    if not base.is_dir("./qt-everywhere-opensource-src-5.9.9"):
        base.cmd("tar", ["-xf", "./qt_source_5.9.9.tar.xz"])

    qt_params = [
        "-opensource", "-confirm-license", "-release", "-shared",
        "-accessibility", "-prefix", "./../qt_build/Qt-5.9.9/gcc_64",
        "-qt-zlib", "-qt-libpng", "-qt-libjpeg", "-qt-xcb", "-qt-pcre",
        "-no-sql-sqlite", "-no-qml-debug", "-gstreamer", "1.0", "-nomake",
        "examples", "-nomake", "tests", "-skip", "qtenginio", "-skip",
        "qtlocation", "-skip", "qtserialport", "-skip", "qtsensors", "-skip",
        "qtxmlpatterns", "-skip", "qt3d", "-skip", "qtwebview", "-skip",
        "qtwebengine"
    ]

    base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "./configure",
                    qt_params)
    base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "make",
                    ["-j", "4"])
    base.cmd_in_dir("./qt-everywhere-opensource-src-5.9.9", "make",
                    ["install"])
    return
Ejemplo n.º 2
0
def install_deps():
    # dependencies
    packages = [
        "apt-transport-https", "autoconf2.13", "build-essential",
        "ca-certificates", "cmake", "curl", "git", "glib-2.0-dev",
        "libglu1-mesa-dev", "libgtk-3-dev", "libpulse-dev", "libtool",
        "p7zip-full", "subversion", "gzip", "libasound2-dev",
        "libatspi2.0-dev", "libcups2-dev", "libdbus-1-dev", "libicu-dev",
        "libglu1-mesa-dev", "libgstreamer1.0-dev",
        "libgstreamer-plugins-base1.0-dev", "libx11-xcb-dev", "libxcb*",
        "libxi-dev", "libxrender-dev", "libxss1"
    ]

    base.cmd("sudo", ["apt-get", "install", "-y"] + packages)

    # nodejs
    if not base.is_file("./node_js_setup_10.x"):
        if "ppc64le" not in platform.machine():
            base.download("https://deb.nodesource.com/setup_10.x",
                          "./node_js_setup_10.x")
        base.cmd("sudo", ["bash", "./node_js_setup_10.x"])
        base.cmd("sudo", ["apt-get", "install", "-y", "nodejs"])
        base.cmd("sudo", ["npm", "install", "-g", "npm"])
        base.cmd("sudo", ["npm", "install", "-g", "grunt-cli"])
        base.cmd("sudo", ["npm", "install", "-g", "pkg"])

    # java
    base.cmd("sudo",
             ["apt-get", "-y", "install", "software-properties-common"])
    base.cmd("sudo", ["add-apt-repository", "-y", "ppa:openjdk-r/ppa"])
    base.cmd("sudo", ["apt-get", "update"])
    base.cmd("sudo", ["apt-get", "-y", "install", "openjdk-8-jdk"])
    base.cmd("sudo", ["update-alternatives", "--config", "java"])
    base.cmd("sudo", ["update-alternatives", "--config", "javac"])
    return
Ejemplo n.º 3
0
def installProgram(sName):
    base.print_info("Installing " + sName + "...")
    if (sName in install_special):
        code = install_special[sName]()
    else:
        if (sName not in downloads_list):
            print("Url for install not found!")
            return False

        download_url = downloads_list[sName]
        file_name = "install."
        is_msi = download_url.endswith('msi')
        if is_msi:
            file_name += "msi"
        else:
            file_name += "exe"
        base.download(download_url, file_name)

        base.print_info("Install " + sName + "...")
        if (sName in install_params):
            install_command = file_name + " " + install_params[sName]
        elif is_msi:
            install_command = "msiexec.exe /i " + file_name + " /qn"
        else:
            install_command = file_name + " /S"

        print(install_command)
        code = os.system(install_command)
        base.delete_file(file_name)

    if (code != 0):
        print("Installing was failed!")
        return False

    return True
Ejemplo n.º 4
0
def installProgram(sName):
    base.print_info("Installing " + sName + "...")
    if (host_platform == 'windows'):
        if (sName in install_special):
            code = install_special[sName]()
        else:
            if (sName not in downloads_list['Windows']):
                print("Url for install not found!")
                return False

            download_url = downloads_list['Windows'][sName]
            file_name = "install."
            is_msi = download_url.endswith('msi')
            if is_msi:
                file_name += "msi"
            else:
                file_name += "exe"
            base.download(download_url, file_name)

            base.print_info("Install " + sName + "...")
            install_command = ("msiexec.exe /i " +
                               file_name) if is_msi else file_name

            if (sName in install_params):
                install_command += " " + install_params.get(sName, '')
            if (is_msi == True):
                install_command += " /qn "
            elif sName not in install_params:
                install_command += " /S"

            print(install_command)
            code = os.system(install_command)
            base.delete_file(file_name)
    elif (host_platform == 'linux'):
        if (sName in install_special):
            code = install_special[sName]()
        else:
            if (sName not in downloads_list['Linux']):
                print("Program for install not found!")
                return False

            base.print_info("Install " + sName + "...")
            install_command = 'yes | sudo apt install ' + downloads_list[
                'Linux'][sName]
            print(install_command)
            code = os.system(install_command)

    if (code != 0):
        print("Installing was failed!")
        return False

    return True
Ejemplo n.º 5
0
def install_postgresql():
  if (host_platform == 'windows'):
    download_url = downloads_list['PostgreSQL']
    file_name = "install.exe"
    base.download(download_url, file_name)
    base.print_info("Install PostgreSQL...")
    install_command = file_name + ' --mode unattended --unattendedmodeui none --superpassword ' + install_params['PostgreSQL']['dbPass'] + ' --serverport ' + install_params['PostgreSQL']['dbPort']
  else:
    base.print_info("Install PostgreSQL...")
    install_command = 'sudo apt install postgresql -y'

  print(install_command)
  code = os.system(install_command)

  if (host_platform == 'windows'):
    base.delete_file(file_name)
  else:
    code = os.system('sudo -i -u postgres psql -c "ALTER USER postgres PASSWORD ' + "'" + install_params['PostgreSQL']['dbPass'] + "'" + ';"') and code

  return code
Ejemplo n.º 6
0
def make():
    if ("windows" != base.host_platform()):
        return

    if not config.check_option("module", "mobile"):
        return

    print("[fetch & build]: glew")
    base_dir = base.get_script_dir() + "/../../core/Common/3dParty/glew"
    old_cur = os.getcwd()
    os.chdir(base_dir)

    base.common_check_version("glew", "1", clean)

    if not base.is_dir("glew-2.1.0"):
        base.download(
            "https://deac-ams.dl.sourceforge.net/project/glew/glew/2.1.0/glew-2.1.0-win32.zip",
            "./archive.zip")
        base.extract("./archive.zip", "./")
        base.delete_file("./archive.zip")

    os.chdir(old_cur)
    return
Ejemplo n.º 7
0
def save_audio(**kwargs):
    link = kwargs['link']
    artist = kwargs['artist'].strip()
    title = kwargs['title'].strip()
    filename = filename_validate('%s - %s.mp3' % (artist, title))
    path_to_save = kwargs['path_to_save']
    fullpath = '{0}{1}'.format(path_to_save, filename)
    if not os.path.exists(fullpath) or os.path.getsize(fullpath) < 1024:
        try:
            with open(fullpath, 'wb') as f:
                f.write(download(link))
        except Exception, e:
            print 'Error on download: {0}'.format(e)
        try:
            audio = EasyID3(fullpath)
            audio['artist'] = artist
            audio['title'] = title
            audio.save()
            print '{0} done'.format(filename)
        except Exception, e:
            print '{0} edit tag error: {1}'.format(filename, e)
Ejemplo n.º 8
0
def make():
  base_dir = base.get_script_dir() + "/../out"
  git_dir = base.get_script_dir() + "/../.."
  core_dir = git_dir + "/core"
  plugins_dir = git_dir + "/sdkjs-plugins"
  branding = config.branding()

  platforms = config.option("platform").split()
  for native_platform in platforms:
    if not native_platform in config.platforms:
      continue

    if (-1 != native_platform.find("_xp")):
      print("Server module not supported on Windows XP")
      continue

    if (-1 != native_platform.find("ios")):
      print("Server module not supported on iOS")
      continue

    if (-1 != native_platform.find("android")):
      print("Server module not supported on Android")
      continue

    root_dir = base_dir + ("/" + native_platform + "/" + branding + "/documentserver")
    root_dir_snap = root_dir + '-snap'
    if (base.is_dir(root_dir)):
      base.delete_dir(root_dir)
    base.create_dir(root_dir)

    build_server_dir = root_dir + '/server'
    server_dir = base.get_script_dir() + "/../../server"
    bin_server_dir = server_dir + "/build/server"

    base.create_dir(build_server_dir + '/DocService')

    base.copy_dir(bin_server_dir + '/Common/config', build_server_dir + '/Common/config')

    base.create_dir(build_server_dir + '/DocService')
    base.copy_exe(bin_server_dir + "/DocService", build_server_dir + '/DocService', "docservice")

    base.create_dir(build_server_dir + '/FileConverter')
    base.copy_exe(bin_server_dir + "/FileConverter", build_server_dir + '/FileConverter', "converter")

    base.create_dir(build_server_dir + '/Metrics')
    base.copy_exe(bin_server_dir + "/Metrics", build_server_dir + '/Metrics', "metrics")
    base.copy_dir(bin_server_dir + '/Metrics/config', build_server_dir + '/Metrics/config')
    base.create_dir(build_server_dir + '/Metrics/node_modules/modern-syslog/build/Release')
    base.copy_file(bin_server_dir + "/Metrics/node_modules/modern-syslog/build/Release/core.node", build_server_dir + "/Metrics/node_modules/modern-syslog/build/Release/core.node")

    base.create_dir(build_server_dir + '/SpellChecker')
    base.copy_exe(bin_server_dir + "/SpellChecker", build_server_dir + '/SpellChecker', "spellchecker")
    base.create_dir(build_server_dir + '/SpellChecker/node_modules/nodehun/build/Release')
    base.copy_file(bin_server_dir + "/SpellChecker/node_modules/nodehun/build/Release/nodehun.node", build_server_dir + '/SpellChecker/node_modules/nodehun/build/Release/nodehun.node')
    

    qt_dir = base.qt_setup(native_platform)
    platform = native_platform

    core_build_dir = core_dir + "/build"
    if ("" != config.option("branding")):
      core_build_dir += ("/" + config.option("branding"))

    platform_postfix = platform + base.qt_dst_postfix()

    converter_dir = root_dir + "/server/FileConverter/bin"
    base.create_dir(converter_dir)

    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "kernel")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "UnicodeConverter")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "graphics")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "PdfWriter")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "PdfReader")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "DjVuFile")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "XpsFile")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "HtmlFile2")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "HtmlRenderer")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "doctrenderer")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "Fb2File")
    base.copy_lib(core_build_dir + "/lib/" + platform_postfix, converter_dir, "EpubFile")
    base.copy_exe(core_build_dir + "/bin/" + platform_postfix, converter_dir, "x2t")

    base.generate_doctrenderer_config(converter_dir + "/DoctRenderer.config", "../../../", "server")

    # icu
    if (0 == platform.find("win")):
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/icudt58.dll", converter_dir + "/icudt58.dll")
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/icuuc58.dll", converter_dir + "/icuuc58.dll")

    if (0 == platform.find("linux")):
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicudata.so.58", converter_dir + "/libicudata.so.58")
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicuuc.so.58", converter_dir + "/libicuuc.so.58")

    if (0 == platform.find("mac")):
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicudata.58.dylib", converter_dir + "/libicudata.58.dylib")
      base.copy_file(core_dir + "/Common/3dParty/icu/" + platform + "/build/libicuuc.58.dylib", converter_dir + "/libicuuc.58.dylib")

    if (0 == platform.find("win")):
      base.copy_files(core_dir + "/Common/3dParty/v8/v8/out.gn/" + platform + "/release/icudt*.dat", converter_dir + "/")
    else:
      base.copy_file(core_dir + "/Common/3dParty/v8/v8/out.gn/" + platform + "/icudtl.dat", converter_dir + "/icudtl.dat")

    # builder
    base.copy_exe(core_build_dir + "/bin/" + platform_postfix, converter_dir, "docbuilder")
    base.copy_dir(git_dir + "/DocumentBuilder/empty", converter_dir + "/empty")

    # js
    js_dir = root_dir
    base.copy_dir(base_dir + "/js/" + branding + "/builder/sdkjs", js_dir + "/sdkjs")
    base.copy_dir(base_dir + "/js/" + branding + "/builder/web-apps", js_dir + "/web-apps")
    
    # plugins
    base.create_dir(js_dir + "/sdkjs-plugins")
    base.copy_sdkjs_plugins(js_dir + "/sdkjs-plugins", False, True)
    base.copy_sdkjs_plugins_server(js_dir + "/sdkjs-plugins", False, True)
    base.create_dir(js_dir + "/sdkjs-plugins/v1")
    base.download("https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js", js_dir + "/sdkjs-plugins/v1/plugins.js")
    base.download("https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js", js_dir + "/sdkjs-plugins/v1/plugins-ui.js")
    base.download("https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css", js_dir + "/sdkjs-plugins/v1/plugins.css")
    base.support_old_versions_plugins(js_dir + "/sdkjs-plugins")
    
    # tools
    tools_dir = root_dir + "/server/tools"
    base.create_dir(tools_dir)
    base.copy_exe(core_build_dir + "/bin/" + platform_postfix, tools_dir, "allfontsgen")
    base.copy_exe(core_build_dir + "/bin/" + platform_postfix, tools_dir, "allthemesgen")

    branding_dir = server_dir + "/branding"
    if("" != config.option("branding") and "onlyoffice" != config.option("branding")):
      branding_dir = git_dir + '/' + config.option("branding") + '/server'

    #dictionaries
    spellchecker_dictionaries = build_server_dir + '/SpellChecker/dictionaries'
    spellchecker_dictionaries_files = server_dir + '/../dictionaries/*_*'
    base.create_dir(spellchecker_dictionaries)
    base.copy_files(spellchecker_dictionaries_files, spellchecker_dictionaries)

    if (0 == platform.find("win")):
      exec_ext = '.exe'
    else:
      exec_ext = ''

    #schema
    schema_files = server_dir + '/schema'
    schema = build_server_dir + '/schema'
    base.create_dir(schema)
    base.copy_dir(schema_files, schema)

    #core-fonts
    core_fonts_files = server_dir + '/../core-fonts'
    core_fonts = build_server_dir + '/../core-fonts'
    base.create_dir(core_fonts)
    base.copy_dir_content(core_fonts_files, core_fonts, "", ".git")

    #license
    license_file1 = server_dir + '/LICENSE.txt'
    license_file2 = server_dir + '/3rd-Party.txt'
    license_dir = server_dir + '/license'
    license = build_server_dir + '/license'
    base.copy_file(license_file1, build_server_dir)
    base.copy_file(license_file2, build_server_dir)
    base.copy_dir(license_dir, license)

    #branding
    welcome_files = branding_dir + '/welcome'
    welcome = build_server_dir + '/welcome'
    base.create_dir(welcome)
    base.copy_dir(welcome_files, welcome)

    info_files = branding_dir + '/info'
    info = build_server_dir + '/info'
    base.create_dir(info)
    base.copy_dir(info_files, info)

    # example
    build_example_dir = root_dir + '-example'
    bin_example_dir = base.get_script_dir() + "/../../document-server-integration/web/documentserver-example/nodejs"

    base.create_dir(build_example_dir)
    base.copy_exe(bin_example_dir, build_example_dir, "example")
    base.copy_dir(bin_example_dir + "/config", build_example_dir + "/config")

    # snap
    if (0 == platform.find("linux")):
      base.create_dir(root_dir_snap)
      base.copy_dir(root_dir, root_dir_snap)
      base.copy_dir(bin_server_dir + '/DocService/node_modules', root_dir_snap + '/server/DocService/node_modules')
      base.copy_dir(bin_server_dir + '/DocService/sources', root_dir_snap + '/server/DocService/sources')
      base.copy_dir(bin_server_dir + '/DocService/public', root_dir_snap + '/server/DocService/public')
      base.delete_file(root_dir_snap + '/server/DocService/docservice')
      base.copy_dir(bin_server_dir + '/FileConverter/node_modules', root_dir_snap + '/server/FileConverter/node_modules')
      base.copy_dir(bin_server_dir + '/FileConverter/sources', root_dir_snap + '/server/FileConverter/sources')
      base.delete_file(root_dir_snap + '/server/FileConverter/converter')
      base.copy_dir(bin_server_dir + '/SpellChecker/node_modules', root_dir_snap + '/server/SpellChecker/node_modules')
      base.copy_dir(bin_server_dir + '/SpellChecker/sources', root_dir_snap + '/server/SpellChecker/sources')
      base.delete_file(root_dir_snap + '/server/SpellChecker/spellchecker')
      base.copy_dir(bin_server_dir + '/Common/node_modules', root_dir_snap + '/server/Common/node_modules')
      base.copy_dir(bin_server_dir + '/Common/sources', root_dir_snap + '/server/Common/sources')

  return
Ejemplo n.º 9
0
def install_deps():
    if base.is_file("./packages_complete"):
        return

    # dependencies
    packages = [
        "apt-transport-https", "autoconf2.13", "build-essential",
        "ca-certificates", "cmake", "curl", "git", "glib-2.0-dev",
        "libglu1-mesa-dev", "libgtk-3-dev", "libpulse-dev", "libtool",
        "p7zip-full", "subversion", "gzip", "libasound2-dev",
        "libatspi2.0-dev", "libcups2-dev", "libdbus-1-dev", "libicu-dev",
        "libglu1-mesa-dev", "libgstreamer1.0-dev",
        "libgstreamer-plugins-base1.0-dev", "libx11-xcb-dev", "libxcb*",
        "libxi-dev", "libxrender-dev", "libxss1", "libncurses5"
    ]

    base.cmd("sudo", ["apt-get", "install", "-y"] + packages)

    # nodejs
    base.cmd("sudo", ["apt-get", "install", "-y", "nodejs"])
    nodejs_cur = 0
    try:
        nodejs_version = base.run_command('node -v')['stdout']
        nodejs_cur_version_major = int(nodejs_version.split('.')[0][1:])
        nodejs_cur_version_minor = int(nodejs_version.split('.')[1])
        nodejs_cur = nodejs_cur_version_major * 1000 + nodejs_cur_version_minor
        print("Installed Node.js version: " + str(nodejs_cur_version_major) +
              "." + str(nodejs_cur_version_minor))
    except:
        nodejs_cur = 1
    if (nodejs_cur < 10020):
        print("Node.js version cannot be less 10.20")
        print("Reinstall")
        if (base.is_dir("./node_js_setup_10.x")):
            base.delete_dir("./node_js_setup_10.x")
        base.cmd("sudo", ["apt-get", "remove", "--purge", "-y", "nodejs"])
        base.download("https://deb.nodesource.com/setup_10.x",
                      "./node_js_setup_10.x")
        base.cmd(
            'curl -fsSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -'
        )
        base.cmd("sudo", ["bash", "./node_js_setup_10.x"])
        base.cmd("sudo", ["apt-get", "install", "-y", "nodejs"])
        base.cmd("sudo", ["npm", "install", "-g", "npm@6"])
    else:
        print("OK")
        base.cmd("sudo", ["apt-get", "-y", "install", "npm", "yarn"], True)
    base.cmd("sudo", ["npm", "install", "-g", "grunt-cli"])
    base.cmd("sudo", ["npm", "install", "-g", "pkg"])

    # java
    java_error = base.cmd("sudo",
                          ["apt-get", "-y", "install", "openjdk-11-jdk"], True)
    if (0 != java_error):
        java_error = base.cmd("sudo",
                              ["apt-get", "-y", "install", "openjdk-8-jdk"],
                              True)
    if (0 != java_error):
        base.cmd("sudo",
                 ["apt-get", "-y", "install", "software-properties-common"])
        base.cmd("sudo", ["add-apt-repository", "-y", "ppa:openjdk-r/ppa"])
        base.cmd("sudo", ["apt-get", "update"])
        base.cmd("sudo", ["apt-get", "-y", "install", "openjdk-8-jdk"])
        base.cmd("sudo", ["update-alternatives", "--config", "java"])
        base.cmd("sudo", ["update-alternatives", "--config", "javac"])

    base.writeFile("./packages_complete", "complete")
    return
Ejemplo n.º 10
0
def make():
    git_dir = base.get_script_dir() + "/../.."
    old_cur = os.getcwd()

    work_dir = git_dir + "/server/FileConverter/bin"
    if not base.is_dir(work_dir):
        base.create_dir(work_dir)

    os.chdir(work_dir)

    arch = "x64"
    arch2 = "_64"
    if ("windows" == base.host_platform()) and not base.host_platform_is64():
        arch = "x86"
        arch2 = "_32"

    url = "http://repo-doc-onlyoffice-com.s3.amazonaws.com/" + base.host_platform(
    ) + "/core/" + config.option("branch") + "/latest/" + arch + "/core.7z"
    data_url = base.get_file_last_modified_url(url)
    old_data_url = base.readFile("./core.7z.data")

    if (old_data_url != data_url):
        print("-----------------------------------------------------------")
        print("Downloading core last version... --------------------------")
        print("-----------------------------------------------------------")
        if (base.is_file("./core.7z")):
            base.delete_file("./core.7z")
        if (base.is_dir("./core")):
            base.delete_dir("./core")
        if (base.is_dir("./HtmlFileInternal")):
            base.delete_dir("./HtmlFileInternal")
        base.download(url, "./core.7z")

        print("-----------------------------------------------------------")
        print("Extracting core last version... ---------------------------")
        print("-----------------------------------------------------------")

        base.extract("./core.7z", "./")
        base.writeFile("./core.7z.data", data_url)

        platform = ""
        if ("windows" == base.host_platform()):
            platform = "win" + arch2
        else:
            platform = base.host_platform() + arch2

        base.copy_files("./core/*", "./")

    base.generate_doctrenderer_config("./DoctRenderer.config",
                                      "../../../sdkjs/deploy/", "server",
                                      "../../../web-apps/vendor/")
    base.support_old_versions_plugins(git_dir + "/sdkjs-plugins")

    if base.is_dir(git_dir + "/fonts"):
        base.delete_dir(git_dir + "/fonts")
    base.create_dir(git_dir + "/fonts")

    if ("mac" == base.host_platform()):
        base.mac_correct_rpath_x2t("./")

    print("-----------------------------------------------------------")
    print("All fonts generation... -----------------------------------")
    print("-----------------------------------------------------------")
    base.cmd_exe("./allfontsgen", [
        "--input=../../../core-fonts",
        "--allfonts-web=../../../sdkjs/common/AllFonts.js",
        "--allfonts=./AllFonts.js", "--images=../../../sdkjs/common/Images",
        "--selection=./font_selection.bin", "--use-system=true",
        "--output-web=../../../fonts"
    ])

    print("All presentation themes generation... ---------------------")
    print("-----------------------------------------------------------")
    base.cmd_exe("./allthemesgen", [
        "--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"",
        "--src=\"" + git_dir + "/sdkjs/slide/themes\"",
        "--output=\"" + git_dir + "/sdkjs/common/Images\""
    ])

    # add directories to open directories
    data_local_devel = "{\n"
    data_local_devel += "\"services\": {\n"
    data_local_devel += "\"CoAuthoring\": {\n"
    data_local_devel += "\"server\": {\n"
    data_local_devel += "\"static_content\": {\n"
    is_exist_addons = False
    for addon in config.sdkjs_addons:
        data_local_devel += ("\"/" + config.sdkjs_addons[addon] +
                             "\" : { \"path\": \"../../../" +
                             config.sdkjs_addons[addon] + "\" },\n")
        is_exist_addons = True
    for addon in config.web_apps_addons:
        data_local_devel += ("\"/" + config.web_apps_addons[addon] +
                             "\" : { \"path\": \"../../../" +
                             config.web_apps_addons[addon] + "\" },\n")
        is_exist_addons = True
    if is_exist_addons:
        data_local_devel = data_local_devel[:-2]
    data_local_devel += "\n"
    data_local_devel += "}\n"
    data_local_devel += "}\n"
    data_local_devel += "}\n"
    data_local_devel += "}\n"
    data_local_devel += "}\n"
    base.writeFile(
        git_dir + "/server/Common/config/local-development-" +
        base.host_platform() + ".json", data_local_devel)

    os.chdir(old_cur)
    return
userInput = input('请输入想下载的图片名称: ')
# 所有的图片数据
count = 0
for page in range(1,5):
    print('第{}页开始'.format(page))
    url = 'https://image.baidu.com/search/acjson?tn=resultjson_com&ipn=rj&ct=201326592&is=&fp=result&cl=2&lm=-1&ie=utf-8&oe=utf-8&adpicid=&st=&z=&ic=&hd=&latest=&copyright=&s=&se=&tab=&width=&height=&face=&istype=&qc=&nc=1&fr=&expermode=&force=&pn=30&rn=55&gsm=1e&1597988871073='
    # 关键的参数
    dic = {
        'pn': 30 * page,
        'rn': 30,
        'queryWord': userInput,
        'word': userInput
    }
    headers = {
        'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.163 Safari/535.1'
    }
    # params: get请求的字典参数
    response = requests.get(url, headers=headers,params=dic)
    # 服务器返回的如果是json数据,使用json()
    content = response.json()

    # 所有的数据(最后一项没有)
    allData = content['data'][:len(content['data']) - 1]
    for img in allData:
        count += 1
        imgUrl = img['hoverURL'] or img['middleURL']
        print(count, '++++',imgUrl)
        # 所有图片的url地址
        # print(img['hoverURL'])
        download(imgUrl)
    print('第{}页开始'.format(page))
Ejemplo n.º 12
0
    download_nums = raw_input('输入邮件编号(直接回车全选)')
    download_nums = all_nums if not download_nums else download_nums.split(' ')

    if download_nums:
        subjects = set() #记录所有下载邮件的标题
        print '\n你选择的邮件编号有: ', [num for num in download_nums]
        for num in download_nums:
            if num in nums:
                subjects.add(datas[num]['subject'])
                attachments = datas[num]['attachments'] #取到该邮件的所有附件
                for atta in attachments:
                    filename = atta['name']
                    data = atta['data']
                    if filename.endswith('.zip'):
                        #如果是压缩文件
                        download(data, abs_path, filename, option=FileType.ZIP)
                    #elif fname.endswith('.rar'):
                    #    download(data, fpath, fname, option=fileType.RAR)
                    else:
                        #如果是普通文件
                        download(data, abs_path, filename, option=FileType.NORMAL)
        print '所有邮件里的附件下载完成\n'
    else:
        print '输入为空,自动退出'
        sys.exit(0)

    zip_(fpath + folder, folder)

    #生成一个 readme 文件记录下载了哪些邮件的附件(记录有哪些宿舍)
    readme = os.path.join(abs_path, 'readme.txt')
    if not os.path.exists(readme):
import requests
from base import download
# rn: 每页的数据条数
# pn: rn * page
url = 'https://image.baidu.com/search/acjson?tn=resultjson_com&ipn=rj&ct=201326592&is=&fp=result&queryWord=%E4%BD%A9%E5%A5%87&cl=2&lm=-1&ie=utf-8&oe=utf-8&adpicid=&st=&z=&ic=&hd=&latest=&copyright=&word=%E4%BD%A9%E5%A5%87&s=&se=&tab=&width=&height=&face=&istype=&qc=&nc=1&fr=&expermode=&force=&pn=30&rn=55&gsm=1e&1597988871073='

headers = {
    'User-Agent':
    'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/14.0.835.163 Safari/535.1'
}
response = requests.get(url, headers=headers)
# 服务器返回的如果是json数据,使用json()
content = response.json()
# 所有的图片数据
count = 0
# 所有的数据(最后一项没有)
allData = content['data'][:len(content['data']) - 1]
for img in allData:
    count += 1
    print(count, '++++')
    # 所有图片的url地址
    # print(img['hoverURL'])
    download(img['hoverURL'])
def make():
    base_dir = base.get_script_dir() + "/../out"
    git_dir = base.get_script_dir() + "/../.."
    core_dir = git_dir + "/core"
    branding = config.branding()

    platforms = config.option("platform").split()
    for native_platform in platforms:
        if not native_platform in config.platforms:
            continue

        root_dir = base_dir + (
            "/" + native_platform + "/" + branding +
            ("/DesktopEditors" if base.is_windows() else "/desktopeditors"))
        if (base.is_dir(root_dir)):
            base.delete_dir(root_dir)
        base.create_dir(root_dir)

        qt_dir = base.qt_setup(native_platform)

        # check platform on xp
        isWindowsXP = False if (-1 == native_platform.find("_xp")) else True
        platform = native_platform[0:-3] if isWindowsXP else native_platform

        apps_postfix = "build" + base.qt_dst_postfix()
        if ("" != config.option("branding")):
            apps_postfix += ("/" + config.option("branding"))
        apps_postfix += "/"
        apps_postfix += platform
        if isWindowsXP:
            apps_postfix += "/xp"

        core_build_dir = core_dir + "/build"
        if ("" != config.option("branding")):
            core_build_dir += ("/" + config.option("branding"))

        platform_postfix = platform + base.qt_dst_postfix()

        # x2t
        base.create_dir(root_dir + "/converter")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "kernel")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "UnicodeConverter")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "graphics")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "PdfWriter")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "PdfReader")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "DjVuFile")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "XpsFile")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "HtmlFile2")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "HtmlRenderer")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "Fb2File")
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                      root_dir + "/converter", "EpubFile")

        if ("ios" == platform):
            base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                          root_dir + "/converter", "x2t")
        else:
            base.copy_exe(core_build_dir + "/bin/" + platform_postfix,
                          root_dir + "/converter", "x2t")

        # icu
        if (0 == platform.find("win")):
            base.copy_file(
                core_dir + "/Common/3dParty/icu/" + platform +
                "/build/icudt58.dll", root_dir + "/converter/icudt58.dll")
            base.copy_file(
                core_dir + "/Common/3dParty/icu/" + platform +
                "/build/icuuc58.dll", root_dir + "/converter/icuuc58.dll")

        if (0 == platform.find("linux")):
            base.copy_file(
                core_dir + "/Common/3dParty/icu/" + platform +
                "/build/libicudata.so.58",
                root_dir + "/converter/libicudata.so.58")
            base.copy_file(
                core_dir + "/Common/3dParty/icu/" + platform +
                "/build/libicuuc.so.58",
                root_dir + "/converter/libicuuc.so.58")

        if (0 == platform.find("mac")):
            base.copy_file(
                core_dir + "/Common/3dParty/icu/" + platform +
                "/build/libicudata.58.dylib",
                root_dir + "/converter/libicudata.58.dylib")
            base.copy_file(
                core_dir + "/Common/3dParty/icu/" + platform +
                "/build/libicuuc.58.dylib",
                root_dir + "/converter/libicuuc.58.dylib")

        # doctrenderer
        if isWindowsXP:
            base.copy_lib(core_build_dir + "/lib/" + platform_postfix + "/xp",
                          root_dir + "/converter", "doctrenderer")
            base.copy_files(
                core_dir + "/Common/3dParty/v8/v8_xp/" + platform +
                "/release/icudt*.dll", root_dir + "/converter/")
        else:
            base.copy_lib(core_build_dir + "/lib/" + platform_postfix,
                          root_dir + "/converter", "doctrenderer")
            if (0 == platform.find("win")):
                base.copy_files(
                    core_dir + "/Common/3dParty/v8/v8/out.gn/" + platform +
                    "/release/icudt*.dat", root_dir + "/converter/")
            else:
                base.copy_file(
                    core_dir + "/Common/3dParty/v8/v8/out.gn/" + platform +
                    "/icudtl.dat", root_dir + "/converter/icudtl.dat")

        base.generate_doctrenderer_config(
            root_dir + "/converter/DoctRenderer.config", "../editors/",
            "desktop")
        base.copy_dir(git_dir + "/desktop-apps/common/converter/empty",
                      root_dir + "/converter/empty")

        # dictionaries
        base.create_dir(root_dir + "/dictionaries")
        base.copy_dir_content(git_dir + "/dictionaries",
                              root_dir + "/dictionaries", "", ".git")

        base.copy_dir(git_dir + "/desktop-apps/common/package/fonts",
                      root_dir + "/fonts")
        base.copy_file(
            git_dir +
            "/desktop-apps/common/package/license/3dparty/3DPARTYLICENSE",
            root_dir + "/3DPARTYLICENSE")

        # cef
        if not isWindowsXP:
            base.copy_files(
                core_dir + "/Common/3dParty/cef/" + platform + "/build/*",
                root_dir)
        else:
            base.copy_files(
                core_dir + "/Common/3dParty/cef/" + native_platform +
                "/build/*", root_dir)

        isUseQt = True
        if (0 == platform.find("mac")) or (0 == platform.find("ios")):
            isUseQt = False

        # libraries
        base.copy_lib(core_build_dir + "/lib/" + platform_postfix, root_dir,
                      "hunspell")
        base.copy_lib(
            core_build_dir + "/lib/" + platform_postfix +
            ("/xp" if isWindowsXP else ""), root_dir, "ooxmlsignature")
        base.copy_lib(
            core_build_dir + "/lib/" + platform_postfix +
            ("/xp" if isWindowsXP else ""), root_dir, "ascdocumentscore")
        if (0 != platform.find("mac")):
            base.copy_lib(
                core_build_dir + "/lib/" + platform_postfix +
                ("/xp" if isWindowsXP else ""), root_dir, "qtascdocumentscore")

        if (0 == platform.find("mac")):
            base.copy_dir(
                core_build_dir + "/bin/" + platform_postfix +
                "/editors_helper.app", root_dir + "/editors_helper.app")
        else:
            base.copy_exe(
                core_build_dir + "/bin/" + platform_postfix +
                ("/xp" if isWindowsXP else ""), root_dir, "editors_helper")

        if isUseQt:
            base.qt_copy_lib("Qt5Core", root_dir)
            base.qt_copy_lib("Qt5Gui", root_dir)
            base.qt_copy_lib("Qt5PrintSupport", root_dir)
            base.qt_copy_lib("Qt5Svg", root_dir)
            base.qt_copy_lib("Qt5Widgets", root_dir)
            base.qt_copy_lib("Qt5Multimedia", root_dir)
            base.qt_copy_lib("Qt5MultimediaWidgets", root_dir)
            base.qt_copy_lib("Qt5Network", root_dir)
            base.qt_copy_lib("Qt5OpenGL", root_dir)

            base.qt_copy_plugin("bearer", root_dir)
            base.qt_copy_plugin("iconengines", root_dir)
            base.qt_copy_plugin("imageformats", root_dir)
            base.qt_copy_plugin("platforms", root_dir)
            base.qt_copy_plugin("platforminputcontexts", root_dir)
            base.qt_copy_plugin("printsupport", root_dir)
            base.qt_copy_plugin("mediaservice", root_dir)
            base.qt_copy_plugin("playlistformats", root_dir)

            base.qt_copy_plugin("platformthemes", root_dir)
            base.qt_copy_plugin("xcbglintegrations", root_dir)

            base.qt_copy_plugin("styles", root_dir)

            if (0 == platform.find("linux")):
                base.qt_copy_lib("Qt5DBus", root_dir)
                base.qt_copy_lib("Qt5X11Extras", root_dir)
                base.qt_copy_lib("Qt5XcbQpa", root_dir)
                base.qt_copy_icu(root_dir)
                base.copy_files(
                    base.get_env("QT_DEPLOY") + "/../lib/libqgsttools_p.so*",
                    root_dir)

            if (0 == platform.find("win")):
                base.copy_file(
                    git_dir + "/desktop-apps/win-linux/extras/projicons/" +
                    apps_postfix + "/projicons.exe",
                    root_dir + "/DesktopEditors.exe")
                base.copy_file(
                    git_dir + "/desktop-apps/win-linux/" + apps_postfix +
                    "/DesktopEditors.exe", root_dir + "/editors.exe")
                base.copy_file(
                    git_dir +
                    "/desktop-apps/win-linux/res/icons/desktopeditors.ico",
                    root_dir + "/app.ico")
            elif (0 == platform.find("linux")):
                base.copy_file(
                    git_dir + "/desktop-apps/win-linux/" + apps_postfix +
                    "/DesktopEditors", root_dir + "/DesktopEditors")

            base.copy_lib(
                core_build_dir + "/lib/" + platform_postfix +
                ("/xp" if isWindowsXP else ""), root_dir, "videoplayer")

        base.create_dir(root_dir + "/editors")
        base.copy_dir(base_dir + "/js/" + branding + "/desktop/sdkjs",
                      root_dir + "/editors/sdkjs")
        base.copy_dir(base_dir + "/js/" + branding + "/desktop/web-apps",
                      root_dir + "/editors/web-apps")
        base.copy_dir(
            git_dir + "/desktop-sdk/ChromiumBasedEditors/resources/local",
            root_dir + "/editors/sdkjs/common/Images/local")

        base.create_dir(root_dir + "/editors/sdkjs-plugins")
        base.copy_sdkjs_plugins(root_dir + "/editors/sdkjs-plugins", True,
                                True)
        # remove some default plugins
        if base.is_dir(root_dir + "/editors/sdkjs-plugins/speech"):
            base.delete_dir(root_dir + "/editors/sdkjs-plugins/speech")

        # io
        base.create_dir(root_dir + "/editors/sdkjs-plugins/v1")
        base.download(
            "https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.js",
            root_dir + "/editors/sdkjs-plugins/v1/plugins.js")
        base.download(
            "https://onlyoffice.github.io/sdkjs-plugins/v1/plugins-ui.js",
            root_dir + "/editors/sdkjs-plugins/v1/plugins-ui.js")
        base.download(
            "https://onlyoffice.github.io/sdkjs-plugins/v1/plugins.css",
            root_dir + "/editors/sdkjs-plugins/v1/plugins.css")
        base.support_old_versions_plugins(root_dir + "/editors/sdkjs-plugins")

        base.copy_sdkjs_plugin(
            git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins",
            root_dir + "/editors/sdkjs-plugins", "manager", True)
        base.copy_sdkjs_plugin(
            git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins/encrypt",
            root_dir + "/editors/sdkjs-plugins", "advanced2", True)
        #base.copy_dir(git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins/encrypt/ui/common/{14A8FC87-8E26-4216-B34E-F27F053B2EC4}", root_dir + "/editors/sdkjs-plugins/{14A8FC87-8E26-4216-B34E-F27F053B2EC4}")
        #base.copy_dir(git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins/encrypt/ui/engine/database/{9AB4BBA8-A7E5-48D5-B683-ECE76A020BB1}", root_dir + "/editors/sdkjs-plugins/{9AB4BBA8-A7E5-48D5-B683-ECE76A020BB1}")

        if (0 != platform.find("mac")):
            base.copy_sdkjs_plugin(
                git_dir + "/desktop-sdk/ChromiumBasedEditors/plugins",
                root_dir + "/editors/sdkjs-plugins", "sendto", True)

        base.copy_file(base_dir + "/js/" + branding + "/desktop/index.html",
                       root_dir + "/index.html")
        base.copy_dir(git_dir + "/desktop-apps/common/loginpage/providers",
                      root_dir + "/providers")

        isUseJSC = False
        if (0 == platform.find("mac")):
            file_size_doctrenderer = os.path.getsize(
                root_dir + "/converter/libdoctrenderer.dylib")
            print("file_size_doctrenderer: " + str(file_size_doctrenderer))
            if (file_size_doctrenderer < 5 * 1024 * 1024):
                isUseJSC = True

        if isUseJSC:
            base.delete_file(root_dir + "/converter/icudtl.dat")

        if (0 == platform.find("win")):
            base.copy_lib(
                git_dir + "/desktop-apps/win-linux/3dparty/WinSparkle/" +
                platform, root_dir, "WinSparkle")
            base.delete_file(root_dir + "/cef_sandbox.lib")
            base.delete_file(root_dir + "/libcef.lib")

        # all themes generate ----
        base.copy_exe(core_build_dir + "/bin/" + platform_postfix,
                      root_dir + "/converter", "allfontsgen")
        base.copy_exe(core_build_dir + "/bin/" + platform_postfix,
                      root_dir + "/converter", "allthemesgen")

        if (0 == platform.find("mac")):
            base.mac_correct_rpath_desktop(root_dir)

        themes_params = []
        if ("" != config.option("themesparams")):
            themes_params = [
                "--params=\"" + config.option("themesparams") + "\""
            ]
        base.cmd_exe(root_dir + "/converter/allfontsgen", [
            "--use-system=\"1\"", "--input=\"" + root_dir + "/fonts\"",
            "--input=\"" + git_dir + "/core-fonts\"",
            "--allfonts=\"" + root_dir + "/converter/AllFonts.js\"",
            "--selection=\"" + root_dir + "/converter/font_selection.bin\""
        ])
        base.cmd_exe(root_dir + "/converter/allthemesgen", [
            "--converter-dir=\"" + root_dir + "/converter\"",
            "--src=\"" + root_dir + "/editors/sdkjs/slide/themes\"",
            "--allfonts=\"AllFonts.js\"",
            "--output=\"" + root_dir + "/editors/sdkjs/common/Images\""
        ] + themes_params)

        base.delete_exe(root_dir + "/converter/allfontsgen")
        base.delete_exe(root_dir + "/converter/allthemesgen")
        base.delete_file(root_dir + "/converter/AllFonts.js")
        base.delete_file(root_dir + "/converter/font_selection.bin")

        if not isUseJSC:
            base.delete_file(root_dir + "/editors/sdkjs/slide/sdk-all.cache")

    return
Ejemplo n.º 15
0
def make():
    git_dir = base.get_script_dir() + "/../.."
    old_cur = os.getcwd()

    work_dir = git_dir + "/server/FileConverter/bin"
    if not base.is_dir(work_dir):
        base.create_dir(work_dir)

    os.chdir(work_dir)

    arch = "x64"
    arch2 = "_64"
    if ("windows" == base.host_platform()) and not base.host_platform_is64():
        arch = "x86"
        arch2 = "_32"

    url = get_core_url(arch, config.option("branch"))
    data_url = base.get_file_last_modified_url(url)
    if (data_url == "" and config.option("branch") != "develop"):
        url = get_core_url(arch, "develop")
        data_url = base.get_file_last_modified_url(url)

    old_data_url = base.readFile("./core.7z.data")

    if (data_url != "" and old_data_url != data_url):
        print("-----------------------------------------------------------")
        print("Downloading core last version... --------------------------")
        print("-----------------------------------------------------------")
        if (base.is_file("./core.7z")):
            base.delete_file("./core.7z")
        if (base.is_dir("./core")):
            base.delete_dir("./core")
        base.download(url, "./core.7z")

        print("-----------------------------------------------------------")
        print("Extracting core last version... ---------------------------")
        print("-----------------------------------------------------------")

        base.extract("./core.7z", "./")
        base.writeFile("./core.7z.data", data_url)

        platform = ""
        if ("windows" == base.host_platform()):
            platform = "win" + arch2
        else:
            platform = base.host_platform() + arch2

        base.copy_files("./core/*", "./")
    else:
        print("-----------------------------------------------------------")
        print("Core is up to date. ---------------------------------------")
        print("-----------------------------------------------------------")

    base.generate_doctrenderer_config("./DoctRenderer.config",
                                      "../../../sdkjs/deploy/", "server",
                                      "../../../web-apps/vendor/")
    base.support_old_versions_plugins(git_dir + "/sdkjs-plugins")

    if base.is_dir(git_dir + "/fonts"):
        base.delete_dir(git_dir + "/fonts")
    base.create_dir(git_dir + "/fonts")

    if ("mac" == base.host_platform()):
        base.mac_correct_rpath_x2t("./")

    print("-----------------------------------------------------------")
    print("All fonts generation... -----------------------------------")
    print("-----------------------------------------------------------")
    base.cmd_exe("./allfontsgen", [
        "--input=../../../core-fonts",
        "--allfonts-web=../../../sdkjs/common/AllFonts.js",
        "--allfonts=./AllFonts.js", "--images=../../../sdkjs/common/Images",
        "--selection=./font_selection.bin", "--use-system=true",
        "--output-web=../../../fonts"
    ])

    print("All presentation themes generation... ---------------------")
    print("-----------------------------------------------------------")
    base.cmd_exe("./allthemesgen", [
        "--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"",
        "--src=\"" + git_dir + "/sdkjs/slide/themes\"",
        "--output=\"" + git_dir + "/sdkjs/common/Images\""
    ])

    #print("- allthemesgen (ios) --------------------------------------")
    #base.cmd_exe("./allthemesgen", ["--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"", "--postfix=ios", "--params=280,224"])
    # android
    #print("- allthemesgen (android) ----------------------------------")
    #base.cmd_exe("./allthemesgen", ["--converter-dir=\"" + git_dir + "/server/FileConverter/bin\"", "--src=\"" + git_dir + "/sdkjs/slide/themes\"", "--output=\"" + git_dir + "/sdkjs/common/Images\"", "--postfix=android", "--params=280,224"])

    # add directories to open directories
    addon_base_path = "../../../"
    server_config = {}
    static_content = {}
    sql = {}

    server_addons = []
    if (config.option("server-addons") != ""):
        server_addons = config.option("server-addons").rsplit(", ")
    if ("server-lockstorage" in server_addons):
        server_config["editorDataStorage"] = "editorDataRedis"

    sdkjs_addons = []
    if (config.option("sdkjs-addons") != ""):
        sdkjs_addons = config.option("sdkjs-addons").rsplit(", ")
    for addon in sdkjs_addons:
        static_content["/" + addon] = {"path": addon_base_path + addon}

    web_apps_addons = []
    if (config.option("web-apps-addons") != ""):
        web_apps_addons = config.option("web-apps-addons").rsplit(", ")
    for addon in web_apps_addons:
        static_content["/" + addon] = {"path": addon_base_path + addon}

    if (config.option("external-folder") != ""):
        external_folder = config.option("external-folder")
        static_content["/sdkjs"] = {
            "path": addon_base_path + external_folder + "/sdkjs"
        }
        static_content["/web-apps"] = {
            "path": addon_base_path + external_folder + "/web-apps"
        }

    if (config.option("sql-type") != ""):
        sql["type"] = config.option("sql-type")
    if (config.option("db-port") != ""):
        sql["dbPort"] = config.option("db-port")
    if (config.option("db-user") != ""):
        sql["dbUser"] = config.option("db-user")
    if (config.option("db-pass") != ""):
        sql["dbPass"] = config.option("db-pass")

    server_config["static_content"] = static_content

    json_file = git_dir + "/server/Common/config/local-development-" + base.host_platform(
    ) + ".json"
    base.writeFile(
        json_file,
        json.dumps(
            {
                "services": {
                    "CoAuthoring": {
                        "server": server_config,
                        "sql": sql
                    }
                }
            },
            indent=2))

    os.chdir(old_cur)
    return
Ejemplo n.º 16
0
def make():
  print("[fetch & build]: cef")

  base_dir = base.get_script_dir() + "/../../core/Common/3dParty/cef"
  old_cur = os.getcwd()
  os.chdir(base_dir)

  platforms = ["win_64", "win_32", "win_64_xp", "win_32_xp", "linux_64", "linux_32", "mac_64"]

  url = "http://d2ettrnqo7v976.cloudfront.net/cef/3770/"

  for platform in platforms:
    if not config.check_option("platform", platform):
      continue

    url += (platform + "/cef_binary.7z")

    if not base.is_dir(platform):
      base.create_dir(platform)

    os.chdir(platform)

    data_url = base.get_file_last_modified_url(url)
    old_data_url = base.readFile("./cef_binary.7z.data")

    if (data_url != old_data_url):
      if base.is_file("./cef_binary.7z"):
        base.delete_file("./cef_binary.7z")
      if base.is_dir("build"):
        base.delete_dir("build")

    if base.is_dir("build"):
      continue

    # download
    if not base.is_file("./cef_binary.7z"):
      base.download(url, "./cef_binary.7z")

    # extract
    base.extract("./cef_binary.7z", "./")

    base.delete_file("./cef_binary.7z.data")
    base.writeFile("./cef_binary.7z.data", data_url)

    base.create_dir("./build")

    # deploy
    if ("mac_64" != platform):
      base.copy_files("cef_binary/Release/*", "build/")
      base.copy_files("cef_binary/Resources/*", "build/")

    if (0 == platform.find("linux")):
      base.cmd("chmod", ["a+xr", "build/locales"])

    if ("mac_64" == platform):
      base.cmd("mv", ["Chromium Embedded Framework.framework", "build/Chromium Embedded Framework.framework"])

    os.chdir(base_dir)

  os.chdir(old_cur)
  return
Ejemplo n.º 17
0
base.configure_common_apps()

freetype_version = "2.10.1"
freetype_name = "freetype-" + freetype_version

# fetch emsdk
if not base.is_dir("emsdk"):
  base.cmd("git", ["clone", "https://github.com/emscripten-core/emsdk.git"])
  os.chdir("emsdk")
  base.cmd("emsdk", ["install", "latest"])
  base.cmd("emsdk", ["activate", "latest"])
  os.chdir("../")

# fetch freetype
if not base.is_dir(freetype_name):
  base.download("https://netcologne.dl.sourceforge.net/project/freetype/freetype2/2.10.1/ft" + freetype_version.replace(".", "") + ".zip", freetype_name + ".zip")
  base.extract(freetype_name + ".zip", "./")


# compile
compiler_flags = ["-o fonts.js",
                  "-O3",
                  "-fno-exceptions",
                  "-fno-rtti",
                  "-s WASM=1",
                  "-s ALLOW_MEMORY_GROWTH=1",
                  "-s FILESYSTEM=0",
                  "-s ENVIRONMENT='web'"]

exported_functions = ["_malloc",
                      "_free",