tis-wampserver

3.2.8-11
WampServer is a Web development platform on Windows that allows you to create dynamic Web applications with Apache2, PHP, MySQL and MariaDB
697 downloads
Download
View on luti logo
tis-wampserver icon

  Description 

  • package : tis-wampserver
  • version : 3.2.8-11
  • architecture : x86
  • categories : System and network
  • maintainer : WAPT Team,Tranquil IT,Jimmy PELÉ
  • description : WampServer is a Web development platform on Windows that allows you to create dynamic Web applications with Apache2, PHP, MySQL and MariaDB
  • locale : all
  • target_os : windows
  • min_wapt_version : 2.0
  • sources : https://wampserver.aviatechno.net/
  • installed_size : 2832973824
  • impacted_process : wampmanager
  • description_fr : WampServer (anciennement WAMP5) est une plateforme de développement Web de type WAMP, permettant de faire fonctionner localement (sans avoir à se connecter à un serveur externe) des scripts PHP
  • description_pl :
  • description_de :
  • description_es :
  • description_pt :
  • description_it :
  • description_nl :
  • description_ru :
  • editor :
  • licence : GPLv2
  • signature_date : 2022-03-15T22:42:25.269337
  • Homepage : https://wampserver.aviatechno.net/
  • Depends :
  • Conflicts :

  Setup.py 

# -*- coding: utf-8 -*-
from setuphelpers import *
import platform
import json

r"""
Usable WAPT package functions: install(), uninstall(), session_setup(), audit(), update_package()

Install/Update informations: https://wampserver.aviatechno.net/

"""
# Declaring global variables - Warnings: 1) WAPT context is only available in package functions; 2) Global variables are not persistent between calls
bin_contains = "wampserver3."
update_bin_contains = "wampserver3_x86_x64_update"


def install():
    # Declaring local variables
    package_version = control.get_software_version()
    bin_name = glob.glob("*%s*.exe" % bin_contains)[0]
    update_bin_name = glob.glob("*%s*.exe" % update_bin_contains)[0]
    app_name = control.name
    installed_version = None
    if control.architecture == "x64":
        app_uninstallkey = r"{wampserver64}_is1"
        app_software_name = "Wampserver64 %s" % package_version
    else:
        app_uninstallkey = r"{wampserver32}_is1"
        app_software_name = "Wampserver32 %s" % package_version
    install_dir = makepath(systemdrive, "wamp")

    # Handle other paths of the software
    app_installed_list = installed_softwares(name=r"\bWampserver")
    for app_info in app_installed_list:
        install_dir = app_info["install_location"]
        installed_version = app_info["version"]

    silent_args = '/DIR="%s" /VERYSILENT /SUPPRESSMSGBOXES' % install_dir

    # Installing the software
    if installed_version is None:
        print("Installing: %s in: %s" % (bin_name, install_dir))
        install_exe_if_needed(
            bin_name,
            silentflags=silent_args,
            key=app_uninstallkey,
            min_version=get_version_from_binary(bin_name),
            timeout=1800,
        )

    def get_app_version(key):
        # app_version_file = makepath(install_dir, "wampmanager.ini")
        app_version_file = makepath(install_dir, "changelog.txt")
        with open(app_version_file, "r") as open_data:
            for aline in open_data.readlines():
                if aline.startswith("--- Wampserver"):
                    return aline.split(" ")[-1].split("\n")[0]

    if need_install(key=app_uninstallkey, min_version=package_version):
        print("Updating: %s from: %s to: %s" % (app_name, installed_version, package_version))
        # run('"%s" %s' % (update_bin_name, silent_args))
        install_exe_if_needed(
            update_bin_name,
            silentflags=silent_args,
            key=app_uninstallkey,
            min_version=control.get_software_version(),
            get_version=get_app_version,
        )
        # register_uninstall(app_uninstallkey, win64app=iswin64(), display_name=app_software_name, display_version=package_version)


def update_package():
    # Declaring local variables
    result = False
    proxies = get_proxies()
    if not proxies:
        proxies = get_proxies_from_wapt_console()
    app_name = control.name
    url = "https://wampserver.aviatechno.net/"
    api_url = "https://sourceforge.net/projects/wampserver/best_release.json"
    if control.architecture == "x64":
        bin_ends = "_x64.exe"
    else:
        bin_ends = "_x86.exe"

    # Getting latest version information from official sources
    print("API used is: %s" % api_url)
    json_load = json.loads(wgets(api_url, proxies=proxies))
    for download in json_load["platform_releases"]:
        if bin_contains in json_load["platform_releases"][download]["filename"]:
            download_url = json_load["platform_releases"][download]["url"].replace("x64", control.architecture)
            latest_bin = json_load["platform_releases"][download]["filename"].split("/")[-1].replace("x64", control.architecture)
            version = latest_bin.split("_")[0].replace("wampserver", "")
            break

    # Getting latest version from official sources
    print("URL used is: %s" % url)
    for bs_search in bs_find_all(url, "a", proxies=proxies):
        if bs_search.string.startswith("Wampserver update"):
            update_version = bs_search.string.split("update ")[-1]
            update_latest_bin = bs_search["href"].split("/")[-1]
            update_download_url = url + bs_search["href"]
            break

    print("Latest %s version is: %s" % (app_name, version))
    print("Download URL is: %s" % download_url)

    # Deleting outdated binaries
    remove_outdated_binaries(version)

    # Downloading latest binaries
    if not isfile(update_latest_bin):
        print("Downloading: %s" % update_latest_bin)
        wget(update_download_url, update_latest_bin, proxies=proxies, connect_timeout=30)

    if not isfile(latest_bin):
        print("Downloading: %s" % latest_bin)
        wget(download_url, latest_bin, proxies=proxies, connect_timeout=30)

    # Checking version from file
    version_from_file = get_version_from_binary(latest_bin)
    if Version(version) != Version(version_from_file) and version_from_file != "":
        print("Changing version to the version number of the binary (from: %s to: %s)" % (version, version_from_file))
        os.rename(latest_bin, "wampserver%s%s" % (version_from_file, bin_ends))
        version = version_from_file
    else:
        print("Binary file version corresponds to online version")

    # Checking version of the update
    update_version_from_file = get_version_from_binary(update_latest_bin)
    if Version(update_version_from_file) > Version(version_from_file):
        if Version(version) != Version(update_version_from_file) and update_version_from_file != "":
            print("Changing version to the version number of the update binary (from: %s to: %s)" % (version, update_version_from_file))
            version = update_version_from_file
        else:
            print("Binary file version corresponds to online version")

    # Changing version of the package
    if Version(version) > Version(control.get_software_version()):
        print("Software version updated (from: %s to: %s)" % (control.get_software_version(), Version(version)))
        result = True
    else:
        print("Software version up-to-date (%s)" % Version(version))
    control.version = "%s-%s" % (Version(version), control.version.split("-", 1)[-1])
    # control.set_software_version(version)
    control.save_control_to_wapt()

    # Validating update-package-sources
    return result


def inifile_readstring(inifilename, section, key, **kwargs):
    r"""Read a string parameter from inifile

    >>> inifile_writestring(r"C:\waptdev\test.conf", section='Options', key="AeTrayMode", "64 Bits")

    >>> print(inifile_readstring(r"C:\waptdev\test.conf", section='Options', key="AeTrayMode"))
    '64 Bits'

    """
    import configparser

    inifile = configparser.RawConfigParser(**kwargs)
    inifile.read(inifilename)
    if inifile.has_section(section) and inifile.has_option(section, key):
        return inifile.get(section, key)
    else:
        return kwargs.get("default", None)


def get_version_from_binary(filename, property_name="ProductVersion"):
    r"""Get installer version from file informations, for now, only exe and msi files are compatibles

    Args:
        filename (str): path to the file
        property_name (str): selected property

    Returns:
        str: version number

    """
    if filename.endswith(".msi"):
        return get_msi_properties(filename)[property_name]
    else:
        return get_file_properties(filename)[property_name]


def remove_outdated_binaries(version, list_extensions=["exe", "msi", "deb", "rpm", "dmg", "pkg"], filename_contains=None):
    r"""Remove files based on the version contained in his filename, failing over on file version on compatible OSes

    Args:
        version (str): version number of keeped files
        list_extensions (str or list of str): file extensions of compared files
        filename_contains (str or list of str): Part of the filename that must be contained (useful for distinguishing architecture and os)

    Returns:
        list: list of deleted files

    .. versionadded:: 2.0

    .. versionchanged:: 2.2
        Now returns removed files, now checking .exe and .msi file versions

    """
    files = []
    if type(list_extensions) != list:
        list_extensions = [list_extensions]
    if filename_contains:
        if type(filename_contains) != list:
            filename_contains = [filename_contains]
    list_extensions = ["." + ext for ext in list_extensions if ext[0] != "."]
    for file_ext in list_extensions:
        for bin_in_dir in glob.glob("*%s" % file_ext):
            if not version in bin_in_dir:
                if platform.system() == "Windows":
                    if file_ext == ".exe" or file_ext == ".msi":
                        if Version(version) == Version(get_version_from_binary(bin_in_dir, "FileVersion")) or Version(version) == Version(
                            get_version_from_binary(bin_in_dir, "ProductVersion")
                        ):
                            print("%s file or product version is correct (%s)" % (bin_in_dir, version))
                            continue
                remove_file(bin_in_dir)
                files.append(bin_in_dir)
            if filename_contains:
                for filename_contain in filename_contains:
                    if not filename_contain in bin_in_dir:
                        remove_file(bin_in_dir)
                        files.append(bin_in_dir)
    return [fn for fn in files]

										
  manifest.sha256