[SOLVED] Adding a non-msi or non-exe file to a 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
flipflip
Messages: 56
Registration: May 31, 2022 - 09:05

October 9, 2024 - 3:18 PM

Hello everyone,

I'm finally getting started with creating Wapt packages, and my first one is very simple. It consists of copying a file (a batch script) into a folder created specifically for this purpose.

In PyScripter, I add it to my project and in the `install()` function of `setup.py`, I copy it using `filecopyto()`
2024-10-09_15-13.png
2024-10-09_15-13.png (12.93 KB) Viewed 2567 times
And the setup.py code

Code: Select all

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

def install():
    # Utilise l'uninstall créé par le msi
    if isfile(r'c:\cygwin\unins000.exe'):
        run(r'"c:\cygwin\unins000.exe" /verysilent')

        # Supprime le paquet de l'installation wapt
        softs = installed_softwares('cygwin')
        if softs:
            for soft in softs:
                run(WAPT.uninstall_cmd(soft['key']))

        # Purge des répertoires cygwin et cygwin64
        if isdir(r'c:\cygwin'):
            remove_tree('c:\cygwin')

        if isdir(r'c:\cygwin64'):
            remove_tree('c:\cygwin64')

    path = makepath(programfiles, 'xxx', 'Backup')
    mkdirs(path)
    filecopyto(r'backup_nomade.bat', path)
    pass
When I launch the installation via "Run configuration" I get the error

Code: Select all

Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\common.py", line 4235, in install_wapt
    exitstatus = setup.install()
  File "E:\waptdev\hil-robocopy-nomade_0_Windows_DEV-wapt\setup.py", line 27, in install
    filecopyto(r'backup_nomade.bat', path)
  File "C:\Program Files (x86)\wapt\setuphelpers.py", line 601, in filecopyto
    raise FileNotFoundError('filecopyto: Cannot copy file %s: file not found' % filename)
FileNotFoundError: filecopyto: Cannot copy file backup_nomade.bat: file not found

FATAL ERROR : None : None
Exit code:  3
I couldn't find in the documentation how to use a file within a package that isn't an MSI or an EXE. Is it possible, or do I have to use an MSI file?

Thanks in advance,
Philippe.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

October 9, 2024 - 5:24 PM

Hi Philippe,

in your screenshot you added the file to the PyScripter project.

Actually, to put the file in the package, you need to copy it to c:\waptdev\mypackage next to the setup.py script. :-)

Simon
flipflip
Messages: 56
Registration: May 31, 2022 - 09:05

October 10, 2024 - 09:07

Hello, thank you for your reply.

Okay, I thought adding it to PyScripter automatically added it to the package's development directory.

Philippe.
User avatar
dcardon
WAPT Expert
Messages: 1929
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

October 10, 2024 - 3:28 PM

Hi Philippe,

thanks for the feedback! :-) You can now give free rein to your creativity!

I'm marking the topic as resolved.

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked