Page 1 of 1

Firefox/Thunderbird addon: install/session_setup order

Published: July 18, 2017 - 5:08 PM
by Aguay
Good morning,

Among the packages offered by TIS there is a package that allows you to install an ad blocker in Firefox.
After reading the package I see that there is an "install" function and a "session_setup" function.

Code: Select all

def install():
    extension_directory=os.path.join(programfiles32,'thunderbird-extension','ublock')
    if not os.path.exists(extension_directory):
        os.makedirs(extension_directory)
    copytree2('mozprofile',os.path.join(extension_directory,'mozprofile'))
    copytree2('manifestparser',os.path.join(extension_directory,'manifestparser'))
    ....

def session_setup():
    extension_directory=os.path.join(programfiles32,'thunderbird-extension','ublock')
    sys.path.append(extension_directory)
    from mozprofile import FirefoxProfile
    from mozprofile import addons
    from mozprofile import profile
    from mozprofile import FirefoxProfi
 .....
    
I wanted to be sure about how Wapt worked.
When the "wapt-get" command is called, does the argument passed to it correspond to one of the functions present in the package?

Let's admit

Code: Select all

wapt-get install tis-paquet1
This means it will call the install function of the package "tis-package1".

Therefore, to use the "session_setup" function, you need to run:

Code: Select all

wapt-get session-setup tis-paquet1
Is that correct?
Is there no implicit default call that launches session-setup if the function exists in the package?

A kind of "install -> If session_setup is defined then session_setup else next"?

Because if that's the case, it means that to install this kind of package you absolutely have to run both commands rather than putting it as a dependency on a package and letting the installation happen automatically?

Thank you for your answers :)

Re: Firefox/Thunderbird addon: install/session_setup order

Published: July 19, 2017 - 09:48
by agauvrit
Hello Aguay,

Indeed, the install and session-setup commands call upon the functions defined in the setup.py file of each package.

These functions have a distinct mode of operation:
  • install is intended for installation; it runs in a system account via the wapt service, with maximum rights for installation.
  • session-setup is intended for customization in user context (typically adding an extension to the Moz/Thun profile), it runs in user context, therefore theoretically with restricted rights on the machine.
One cannot call the other; they are never called in the same context!

The session-setup function is called only once at startup per package version: https://www.wapt.fr/fr/doc/CreationPaqu ... index.html

Hoping this has shed some light on the matter,

Alexander

Re: Firefox/Thunderbird addon: install/session_setup order

Published: July 19, 2017 - 09:56
by Aguay
Hello,

thank you for your quick reply! It really cleared things up for me!

Aguay