Skip to content

Commit

Permalink
Deal with missing build version number
Browse files Browse the repository at this point in the history
Makes it a bit more messy and weird, but that's what you get when your script has 16 parameters, I guess.

Contributes to issue CURA-9365.
  • Loading branch information
Ghostkeeper committed Jul 5, 2022
1 parent 54f9384 commit d91b93b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packaging/NSIS/Ultimaker-Cura.nsi.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
!define APP_NAME "{{ app_name }} {{ version_major }}.{{ version_minor }}.{{ version_patch }}"
!define COMP_NAME "{{ company }}"
!define WEB_SITE "{{ web_site }}"
!define VERSION "{{ version_major }}.{{ version_minor }}.{{ version_patch }}.{{ version_build }}"
!define VERSION "{{ version_major }}.{{ version_minor }}.{{ version_patch }}{{ version_build }}"
!define COPYRIGHT "Copyright (c) {{ year }} {{ company }}"
!define DESCRIPTION "Application"
!define LICENSE_TXT "{{ cura_license_file }}"
Expand Down
25 changes: 16 additions & 9 deletions packaging/NSIS/nsis-configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
- version_major: Major version number of Semver (e.g. 5).
- version_minor: Minor version number of Semver (e.g. 0).
- version_patch: Patch version number of Semver (e.g. 0).
- version_build: A version number that gets manually incremented at each build.
- version_build: (optional) A version number that gets manually incremented at each build.
- company: Publisher of the application. Should be "Ultimaker B.V."
- web_site: Website to find more information. Should be "https://ultimaker.com".
- cura_license_file: Path to a license file in Cura. Should point to packaging/cura_license.txt in this repository.
Expand Down Expand Up @@ -50,23 +50,30 @@
with open(jinja_template_path, "r") as f:
template = Template(f.read())

if len(sys.argv) == 15: # No version-build
version_build = ""
use_version_build = 0
else:
version_build = "." + sys.argv[8]
use_version_build = 1

nsis_content = template.render(
app_name = sys.argv[3],
main_app = sys.argv[4],
version_major = sys.argv[5],
version_minor = sys.argv[6],
version_patch = sys.argv[7],
version_build = sys.argv[8],
company = sys.argv[9],
web_site = sys.argv[10],
version_build = version_build,
company = sys.argv[8 + use_version_build],
web_site = sys.argv[9 + use_version_build],
year = datetime.now().year,
cura_license_file = Path(sys.argv[11]),
compression_method = sys.argv[12], # ZLIB, BZIP2 or LZMA
cura_banner_img = Path(sys.argv[13]),
cura_icon = Path(sys.argv[14]),
cura_license_file = Path(sys.argv[10 + use_version_build]),
compression_method = sys.argv[11 + use_version_build], # ZLIB, BZIP2 or LZMA
cura_banner_img = Path(sys.argv[12 + use_version_build]),
cura_icon = Path(sys.argv[13 + use_version_build]),
mapped_out_paths = mapped_out_paths,
rmdir_paths = rmdir_paths,
destination = Path(sys.argv[15])
destination = Path(sys.argv[14 + use_version_build])
)

with open(dist_loc.parent.joinpath(jinja_template_path.stem), "w") as f:
Expand Down

0 comments on commit d91b93b

Please sign in to comment.