Page 1 of 1

[SOLVED] Package for Postman (Windows/MacOS)

Published: October 30, 2024 - 10:56 AM
by bastien30
Good morning,

If it's of any use, here's the package code I use for the Postman software:

For Windows:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
import time

uninstallkey = []

setup_path = r'C:\ProgramData\postman-installer'
bin_name = r'Postman-win64-Setup.exe'

def install():
    mkdirs(setup_path)
    filecopyto(bin_name, makepath(setup_path, bin_name))

def uninstall():
    for user_path in local_users_profiles():
        # Uninstall silently
        if isfile(makepath(user_path, r'\AppData\Local\Postman', r'Update.exe')):
            run_notfatal(r'"%s" --uninstall -s' % makepath(user_path, r'\AppData\Local\Postman', r'Update.exe'))
            time.sleep(2)
        # Remove local appdata dir
        if isdir(makepath(user_path, r'\AppData\Local\Postman')):
            remove_tree(makepath(user_path, r'\AppData\Local\Postman'))
    remove_tree(setup_path)
    
def session_setup():
    run(r'"%s" -s' % makepath(setup_path, bin_name))
    time.sleep(5)
    for i in range(30):
        if not isfile(makepath(user_local_appdata, r'\Postman\Update.exe')):
            time.sleep(5)
        else:
            break

def update_package():
    url = r'https://dl.pstmn.io/download/latest/win64'
    wget(url, bin_name)
    version_from_file = get_version_from_binary(bin_name)
    version_from_package = control.version.split('-')[0]

    if Version(version_from_file) > Version(version_from_package):
        print(r'Latest Postman version is %s' % version_from_file)
        # Changing version of the package
        control.version = '%s-%s' % (version_from_file, 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 !')
For macOS:

Code: Select all

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

uninstallkey = []

zip_name = r'Postman-MacOS-arm64.zip'
app_name = r'Postman.app'

def install():
    run(r'unzip -qq %s %s/*' % (zip_name, app_name))
    install_app(app_name)

def uninstall():
    uninstall_app(app_name)

def update_package():
    import plistlib
    if isdir(app_name):
        remove_tree(app_name)
    url = r'https://dl.pstmn.io/download/latest/osx_arm64'
    wget(url, zip_name)
    unzip(zip_name, target=r'', filenames=r'%s/*' % app_name)
    version_from_package = control.version.split('-')[0]
    plist_file = plistlib.readPlist(r'%s/Contents/Info.plist' % app_name)
    version_from_plist = plist_file[r'CFBundleShortVersionString']
    remove_tree(app_name)

    if Version(version_from_plist) > Version(version_from_package):
        print(r'Latest Postman version is %s' % version_from_plist)
        # Changing version of the package
        control.version = '%s-%s' % (version_from_plist, 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 !')

Re: [SOLVED] Package for Postman (Windows/MacOS)

Published: November 6, 2024 - 12:00 PM
by dcardon
Hi Bastien,

thanks for sharing. It looks like a pretty good piece of software; I think we'll use it internally too. :-)

Best regards,

Denis

Re: [SOLVED] Package for Postman (Windows/MacOS)

Published: November 8, 2024 - 3:26 PM
by fschelfaut
Hello Bastien,

We have packaged Postman for Windows and macOS. It is currently available in the PREPROD repository and will be accessible on the store in 5 days.

Here are the links to the PREPROD builds:

- Windows x64
- macOS Intel
- macOS ARM

Best regards,
Flavien

Re: [SOLVED] Package for Postman (Windows/MacOS)

Published: November 8, 2024 - 4:43 PM
by bastien30
Hello,

Great, I'll wait until it's in the stable repository to check it out and probably replace my packages with yours :D

. Thank you.

Re: [SOLVED] Package for Postman (Windows/MacOS)

Published: Dec 17, 2024 - 12:27
by bastien30
fschelfaut wrote: Nov 8, 2024 - 3:26 PM Hello Bastien,

We have packaged Postman for Windows and macOS. It is currently available in the PREPROD repository and will be accessible in the store in 5 days.

Here are the links to the PREPROD builds:

- Windows x64
- macOS Intel
- macOS arm

Best regards,
Flavien
Good morning,

I downloaded your packages instead of mine because they are cleaner (installation in program files).
However, I've noticed a small problem after a package update; under Windows, the program starts and then closes a few seconds later.

After investigation, it was due to the AppData\Roaming\Postman\storage\settings.json file in which there is a "lastKnownVersion" parameter which has the value of the previously installed version.
If we update the value with the new version, the program starts normally.

Would it be possible to add this modification to the package, please?
I think it would therefore be necessary to do this for all users.

Thanks in advance.

Re: [SOLVED] Package for Postman (Windows/MacOS)

Published: Dec 20, 2024 - 10:05 AM
by fschelfaut
Hi Bastien,

Thanks for your feedback! Indeed, I hadn't considered that file.
I've therefore adapted the code so that settings.json is automatically updated (session-setup).

You can find the package in PREPROD here.

Please let me know if this resolves your issue.

Flavien,

Re: [SOLVED] Package for Postman (Windows/MacOS)

Published: Dec 20, 2024 - 5:11 PM
by bastien30
Thank you so much! :)

Re: [SOLVED] Package for Postman (Windows/MacOS)

Published: Dec 26, 2024 - 5:11 PM
by bastien30
Hello,

I just updated Postman, everything works fine :D

. Thank you!