-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use module version for version field #127
Comments
You can't currently do this using a config file, which is the normal way I recommend you use Pynsist. I'll consider it as a possible feature for future versions. You can do it through the Pynsist Python API, with code something like this: import mymodule
from nsist import InstallerBuilder
InstallerBuilder('myapp', mymodule.__version__,
... # Other parameters go here
).run() I consider this API semi-public: it's liable to break more often, and with less helpful error messages, than running Pynsist on a config file. |
Thanks! How would you provide the 'entry_point' parameter using this method? I'm getting various errors with this:
The project is not very complex, and the configuration will not change much. So I'm thinking that if it works once, it should be OK... |
I think you need to ensure that that shortcut dictionary contains |
Ok, thanks. I finally gave up: I found that I had to provide twice the icon (first in "shortcuts" and then in "icon"), but mainly while I though I gave all informations, the installer create a windows shortcut "Application", instead of the name of the application. Initially my goal was to update the version number from the module, so I'll do it manually (and possibly upgrade if the functionnality is integrated in pynsist). |
No problem. You might want to look at bumpversion as a way to streamline updating the version number in several places. |
I though I could jump in and leave here, as an example, my use of the builder API with a import nsist
from pathlib import Path
from src import application
icon = Path('icons', application.ICON).resolve()
requirements = open('requirements.txt').read().strip().split('\n')
builder = nsist.InstallerBuilder(
appname=application.NAME,
version=application.VERSION,
icon=icon,
shortcuts={
application.NAME: {
'entry_point': 'src.application:main',
'console': False,
'icon': icon,
}
},
py_version='3.6.0',
py_bitness=64,
pypi_wheel_reqs=requirements,
)
builder.run() I hope this minimal setup can help you. Of course I am open to suggestions to improve it. By no means I claim this is the way to go. I use this in a |
Interesting, thanks for this contribution! I think I'll try this at some point and let you know if all is good |
Alternatively, you can use a template for the cfg and fill it at build time. Assumptions are you have a template.cfg with
|
If you do use The templating approach should work fine too. Amusingly, Pynsist itself uses templating to generate the NSIS file, and NSIS has its own preprocessor system. It's templates all the way down. ;-) |
Hi,
I'm trying to configure pynsist (great work by the way) to init the version field using the application module version. In the doc and all exemples, I always see "version=1.0" . Is there a way tu put "version=mymodule.version", of something like that? If not, this would be a great feature.
Alexis
The text was updated successfully, but these errors were encountered: