mailbagit icon indicating copy to clipboard operation
mailbagit copied to clipboard

mailbagit.py and mailbagit-gui.py manually created shims unnecessary for docker

Open pobocks opened this issue 2 years ago • 3 comments

Describe the bug When getting the app to work in docker, scripts were added to the top level mailbag directory that replicate the entry-point functionality given by setuptools for an installed version of mailbag. On the surface, this works fine, and we might not hit problems, but those shims actually do substantial work to make sure imports and other things work as expected, and it's I think not good practice to add them when instead we can just install the package as intended.

To wit, I would argue that the manually created shims should be deleted, and then rather than just copying the directory in the dockerfile, copy the directory and then:

pip install .

from the setup directory. This will create the mailbagit and mailbagit-gui shims.

@gwiedeman

pobocks avatar Jun 13 '22 03:06 pobocks

Thanks for this! I was expecting users to use the mailbagit command in the docker instance. The mailbagit.py and mailbagit-gui.py files end up there in the dev docker image because they are in the repo and used to build the executables during the release workflow with pyinstaller --onefile mailbagit.py.

Definitely open to feedback on this if there's a better way! Maybe just more in the Docker docs saying to use `mailbagit' entry point?

gwiedeman avatar Jun 14 '22 21:06 gwiedeman

This might avoid those files: https://github.com/pyinstaller/pyinstaller/wiki/Recipe-Setuptools-Entry-Point

gwiedeman avatar Jun 22 '22 00:06 gwiedeman

This did not work when I tried it;

Traceback (most recent call last):
    return _run_code(code, main_globals, None,
  File "C:\Users\gw234478\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\gw234478\.virtualenvs\projects-mTKVb1Jc\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "C:\Users\gw234478\.virtualenvs\projects-mTKVb1Jc\lib\site-packages\PyInstaller\__main__.py", line 178, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "C:\Users\gw234478\.virtualenvs\projects-mTKVb1Jc\lib\site-packages\PyInstaller\__main__.py", line 59, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "C:\Users\gw234478\.virtualenvs\projects-mTKVb1Jc\lib\site-packages\PyInstaller\building\build_main.py", line 845, in main
    build(specfile, distpath, workpath, clean_build)
  File "C:\Users\gw234478\.virtualenvs\projects-mTKVb1Jc\lib\site-packages\PyInstaller\building\build_main.py", line 767, in build
    exec(code, spec_namespace)
  File "mailbagit-guided.spec", line 42, in <module>
    a = Entrypoint(
  File "mailbagit-guided.spec", line 27, in Entrypoint
    kwargs['pathex'] = [ep.dist.location] + kwargs['pathex']
AttributeError: 'NoneType' object has no attribute 'dist'

I tried it by adding def Entrypoint to mailbagit-guided.spec and replaced Analysis() with:

a = Entrypoint('mailbagit', 'console_scripts', 'mailbagit-guided')

The example is not giving Entrypoint() any kwargs so I think its just broken?

gwiedeman avatar Jun 28 '22 16:06 gwiedeman