[SOLVED] My Anagen2+ package

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

October 10, 2019 - 10:21

Popopopopo \o/ I finally managed to finish this package, which was probably the one that gave me the most trouble...

I'm sharing my code with you and I'd like to especially thank gaelds for his post (viewtopic.php?t=974) as well as the sharing of its packages which allowed me to finalize my version:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
global destdir
destdir = makepath(programfiles32,'Anagene2','Anagene2Plus_maj_2018')
daopath = makepath(programfiles32,'Common Files','microsoft shared','DAO')

def install():
    print('Installation de Anagene 2+ version 2012')
    if not isfile(makepath(daopath,'DAO350.DLL')):
        filecopyto(makepath('%s' % basedir,'Anagene','Common','Microsoft Shared','DAO','DAO350.DLL'),makepath(programfiles32,'Common Files','microsoft shared','DAO'))
    run_powershell(r'Start-Process regsvr32.exe -Wait -ArgumentList "/s `"%s\DAO350.DLL`"" -verb runAs' % daopath)
    run_powershell(r'Start-Process cmd.exe -Wait -ArgumentList "/C %s\Anagene\setup.exe /S /v/qn" -verb runAs' % basedir)
    if iswin64:
        with disable_file_system_redirection():
            filecopyto('COMDLG32.OCX',system32())
            #C:\Windows\SysWOW64\
            register_dll(makepath(system32(),'COMDLG32.OCX'))
    else:
        with disable_file_system_redirection():
            filecopyto('COMDLG32.OCX',system32())
            register_dll(makepath(system32(),'COMDLG32.OCX'))

    print('Installation de Anagene 2+ version 2018 (portable)')
    if not isdir(destdir):
        mkdirs(destdir)
        copytree2('%s\Anagene2Plus_maj_2018' % basedir,destdir)
    create_desktop_shortcut(r'Anagene2+',target=r'%s\Anagene2\Anagene2Plus_maj_2018\anagene2.exe' %programfiles32,wDir=r'%s\Anagene2\Anagene2Plus_maj_2018\\' %programfiles32,icon=r'%s\Anagene2\Anagene2Plus_maj_2018\anagene2.exe' %programfiles32)

def uninstall():
    print('Desinstallation de Anagene 2+')
    if isdir(destdir):
        remove_tree(makepath(programfiles32,'Anagene2'))
        run_powershell(r'Start-Process regsvr32.exe -Wait -ArgumentList "/u /s `"%s\DAO350.DLL`"" -verb runAs' % daopath)
        remove_file(makepath(programfiles32,'Common Files','microsoft shared','DAO','DAO350.DLL'))
        remove_file(makepath(programfiles32,'Common Files','microsoft shared','DAO','DAO2535.TLB'))
        remove_desktop_shortcut('Anagene2+.lnk')
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
olaplanche
Messages: 178
Registration: January 26, 2017 - 11:11

November 12, 2019 - 09:17

The package has been updated because the MSCOMCT2.OCX file was still missing and needed to be saved in order to open the molecules from the software:

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
uninstallkey = []
global destdir
destdir = makepath(programfiles32,'Anagene2','Anagene2Plus_maj_2018')
daopath = makepath(programfiles32,'Common Files','microsoft shared','DAO')

def install():
    print('Installation de Anagene 2+ version 2012')
    if not isfile(makepath(daopath,'DAO350.DLL')):
        filecopyto(makepath('%s' % basedir,'Anagene','Common','Microsoft Shared','DAO','DAO350.DLL'),makepath(programfiles32,'Common Files','microsoft shared','DAO'))
    run_powershell(r'Start-Process regsvr32.exe -Wait -ArgumentList "/s `"%s\DAO350.DLL`"" -verb runAs' % daopath)
    run_powershell(r'Start-Process cmd.exe -Wait -ArgumentList "/C %s\Anagene\setup.exe /S /v/qn" -verb runAs' % basedir)
    if iswin64:
        with disable_file_system_redirection():
            filecopyto('Anagene\System32\COMDLG32.OCX',system32())
            filecopyto('Anagene\System32\MSCOMCT2.OCX',system32())
            #C:\Windows\SysWOW64\
            register_dll(makepath(system32(),'COMDLG32.OCX'))
            register_dll(makepath(system32(),'MSCOMCT2.OCX'))
    else:
        with disable_file_system_redirection():
            filecopyto('Anagene\System32\COMDLG32.OCX',system32())
            filecopyto('Anagene\System32\MSCOMCT2.OCX',system32())
            register_dll(makepath(system32(),'COMDLG32.OCX'))
            register_dll(makepath(system32(),'MSCOMCT2.OCX'))

    print('Installation de Anagene 2+ version 2018 (portable)')
    if not isdir(destdir):
        mkdirs(destdir)
        copytree2('%s\Anagene2Plus_maj_2018' % basedir,destdir)
    create_desktop_shortcut(r'Anagene2+',target=r'%s\Anagene2\Anagene2Plus_maj_2018\anagene2.exe' %programfiles32,wDir=r'%s\Anagene2\Anagene2Plus_maj_2018\\' %programfiles32,icon=r'%s\Anagene2\Anagene2Plus_maj_2018\anagene2.exe' %programfiles32)

def uninstall():
    print('Desinstallation de Anagene 2+')
    if isdir(destdir):
        remove_tree(makepath(programfiles32,'Anagene2'))
        run_powershell(r'Start-Process regsvr32.exe -Wait -ArgumentList "/u /s `"%s\DAO350.DLL`"" -verb runAs' % daopath)
        remove_file(makepath(programfiles32,'Common Files','microsoft shared','DAO','DAO350.DLL'))
        remove_file(makepath(programfiles32,'Common Files','microsoft shared','DAO','DAO2535.TLB'))
        remove_desktop_shortcut('Anagene2+.lnk')
- Installed WAPT version: 2.6.0.16795 Enterprise
- Server OS: Linux / Debian Bookworm
- Administration/package creation machine OS: Windows 10
Locked