Page 1 of 1

[SOLVED] Adding a non-msi or non-exe file to a package

Published: October 9, 2024 - 3:18 PM
by flipflip
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 2568 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.

Re: Adding a non-msi or non-exe file to a package

Published: October 9, 2024 - 5:24 PM
by sfonteneau
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

Re: Adding a non-msi or non-exe file to a package

Published: October 10, 2024 - 09:07
by flipflip
Hello, thank you for your reply.

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

Philippe.

Re: Adding a non-msi or non-exe file to a package

Published: October 10, 2024 - 3:28 PM
by dcardon
Hi Philippe,

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

I'm marking the topic as resolved.

Denis