Page 1 of 1

[SOLVED] Package for ChatGPT (MacOS)

Published: September 4, 2025 - 12:00 PM
by bastien30
Good morning,

I made a package for the ChatGPT desktop client for MacOS, with update_package() working.

Note: according to their website, the DMG is compatible with ARM processors only.

For Windows, the application is available in the store, so you just need to use the dedicated template package: https://wapt.tranquil.it/store/fr/tis-t ... -store-app

setup.py:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
from setupdevhelpers import *
import plistlib

def install():
    # Initializing variables
    package_version = control.version.split("-")[0]
    app_name = control.name

    # Installing the package
    bin_name= glob.glob('%s*.dmg' % app_name)[0]
    install_dmg(bin_name, key="/Applications/%s.app" % app_name, min_version=package_version)

def update_package():
    app_name = control.name
    bin_name = r'%s.dmg' % app_name
    dl_url = r'%s/%s' % (control.sources, bin_name)
    plist_file_name = r'Info.plist'

    # Downloading and extracting to compare version
    if isfile(bin_name):
        remove_file(bin_name)
    wget(dl_url, bin_name)

    if isfile(plist_file_name):
        remove_file(plist_file_name)
    unzip_with_7zip(bin_name, target=basedir, filenames=["%s Installer/%s.app/Contents/Info.plist" % (app_name, app_name)], extract_with_full_paths=False, recursive=False)
    
    plist_file = get_plist_obj(plist_file_name)
    latest_version = plist_file[r'CFBundleShortVersionString']
    print(r'Latest %s version is %s' % (app_name, latest_version))
    remove_file(plist_file_name)

    if Version(latest_version) > Version(control.get_software_version()):
        print(r'Latest %s version is %s' % (app_name, latest_version))
        # Changing version of the package
        control.version = '%s-%s' % (latest_version, control.version.split('-', 1)[-1])
        control.save_control_to_wapt()
        print('Changing version to: %s in WAPT\\control' % control.version)
    else:
        print(r'Already up to date !')

def get_plist_obj(plist_file):
    """ Returns a plist obj when given the path to a plist file. """

    with open(plist_file, 'rb') as fp :
        plist_obj = plistlib.load(fp)
    return plist_obj
control:

Code: Select all

package           : xxx-chatgpt
version           : 1.2025.231-2
architecture      : arm
section           : base
priority          : optional
name              : ChatGPT
categories        : Utilities
maintainer        : XXXX
description       : ChatGPT Officiel Desktop Client
depends           : 
conflicts         : 
maturity          : PROD
locale            : all
target_os         : darwin
min_wapt_version  : 2.0
sources           : https://persistent.oaistatic.com/sidekick/public/
installed_size    : 
impacted_process  : chatgpt
description_fr    : 
description_pl    : 
description_de    : 
description_es    : 
description_pt    : 
description_it    : 
description_nl    : 
description_ru    : 
audit_schedule    : 
editor            : OpenAI
keywords          : 
licence           : proprietary_free,wapt_public
homepage          : https://chatgpt.com
package_uuid      :
valid_from        : 
valid_until       : 
forced_install_on : 
changelog         : https://help.openai.com/en/articles/9703738-chatgpt-macos-app-release-notes
min_os_version    : 
max_os_version    :