Fix Windows msi and exe builds
parent
c9bc474477
commit
1f26d485f5
60
setup.py
60
setup.py
|
@ -1,73 +1,85 @@
|
||||||
import distutils, distutils.util
|
import distutils, distutils.util
|
||||||
import os
|
import os
|
||||||
import setuptools
|
import setuptools
|
||||||
|
import sys
|
||||||
|
|
||||||
import lokrez, lokrez.version
|
import lokrez, lokrez.version
|
||||||
|
|
||||||
if os.name == "nt":
|
|
||||||
import cx_Freeze
|
|
||||||
|
|
||||||
author = "Lertsenem"
|
|
||||||
mail = "lertsenem@lertsenem.com"
|
|
||||||
|
|
||||||
# Load README for long_description
|
# Load README for long_description
|
||||||
with open("README.adoc", "r") as fh:
|
with open("README.adoc", "r") as fh:
|
||||||
long_description = fh.read()
|
long_description = fh.read()
|
||||||
|
|
||||||
|
# Windows build
|
||||||
if os.name == "nt":
|
if os.name == "nt":
|
||||||
enterprise = "Smash@Lyon"
|
import cx_Freeze
|
||||||
|
|
||||||
arch = distutils.util.get_platform().split("-")[-1]
|
arch = distutils.util.get_platform().split("-")[-1]
|
||||||
|
|
||||||
build_exe_options = {
|
build_exe_options = {
|
||||||
"packages": ["os"],
|
"packages": ["os"],
|
||||||
"include_msvcr": True,
|
"include_msvcr": True,
|
||||||
|
"include_files": [ "lokrez/data", "lokrez/templates", "lokrez/queries" ],
|
||||||
|
"includes": ["idna.idnadata"], # Because of cx-freeze bug
|
||||||
}
|
}
|
||||||
|
|
||||||
bdist_msi_options = {
|
bdist_msi_options = {
|
||||||
"upgrade_code": "{123456789-1337-8483-ABCD-DEADBEEFCAFE}",
|
"upgrade_code": "{123456789-1337-8483-ABCD-DEADBEEFCAFE}",
|
||||||
"add_to_path": True,
|
"add_to_path": True,
|
||||||
"initial_target_dir": r"[LocalAppDataFolder]\{}\{}" \
|
"initial_target_dir": r"[LocalAppDataFolder]\{}\{}" \
|
||||||
.format(
|
.format(
|
||||||
enterprise,
|
lokrez.version.ENTITY,
|
||||||
lokrez.version.NAME,
|
lokrez.version.NAME,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base = None
|
||||||
|
|
||||||
|
cx_Freeze.setup(
|
||||||
|
name = lokrez.version.NAME,
|
||||||
|
version = lokrez.version.__version__.replace("dev", "1337"),
|
||||||
|
author = lokrez.version.AUTHOR,
|
||||||
|
author_email = lokrez.version.AUTHOR_EMAIL,
|
||||||
|
description = lokrez.version.DESCRIPTION,
|
||||||
|
install_requires = [
|
||||||
|
"jinja2",
|
||||||
|
"requests",
|
||||||
|
"appdirs",
|
||||||
|
],
|
||||||
options = {
|
options = {
|
||||||
"build_exe": build_exe_options,
|
"build_exe": build_exe_options,
|
||||||
"bdist_msi": bdist_msi_options,
|
"bdist_msi": bdist_msi_options,
|
||||||
},
|
},
|
||||||
|
|
||||||
base = None
|
|
||||||
|
|
||||||
executables = [
|
executables = [
|
||||||
cx_Freeze.Executable(
|
cx_Freeze.Executable(
|
||||||
script = "__init__.py",
|
script = "lokrez/__main__.py",
|
||||||
targetName = "{}.exe".format(lokrez.version.NAME),
|
targetName = "{}.exe".format(lokrez.version.NAME),
|
||||||
base = base,
|
base = base,
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
|
)
|
||||||
|
|
||||||
setup = cx_Freeze.setup
|
sys.exit(0)
|
||||||
|
|
||||||
else:
|
# Linux build
|
||||||
options = None
|
if os.name == "posix":
|
||||||
executables = None
|
|
||||||
setup = setuptools.setup
|
|
||||||
|
|
||||||
setup(
|
setuptools.setup(
|
||||||
name = lokrez.version.NAME,
|
name = lokrez.version.NAME,
|
||||||
version = lokrez.__version__,
|
version = lokrez.__version__,
|
||||||
author = author,
|
author = lokrez.version.AUTHOR,
|
||||||
author_email = mail,
|
author_email = lokrez.version.AUTHOR_EMAIL,
|
||||||
description = "A smash.gg-connected local results generator for SSBU",
|
description = lokrez.version.DESCRIPTION,
|
||||||
long_description = long_description,
|
long_description = long_description,
|
||||||
long_description_content_type = "text/asciidoc",
|
long_description_content_type = "text/asciidoc",
|
||||||
url = "https://git.lertsenem.com/lertsenem/ssbu_lokrez",
|
url = lokrez.version.URL,
|
||||||
packages = ["lokrez"],
|
packages = ["lokrez"],
|
||||||
install_requires = [
|
install_requires = [
|
||||||
"jinja2",
|
"jinja2",
|
||||||
"requests",
|
"requests",
|
||||||
|
"appdirs",
|
||||||
],
|
],
|
||||||
license = "MIT",
|
license = lokrez.version.__license__,
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Programming Language :: Python :: 3",
|
"Programming Language :: Python :: 3",
|
||||||
"License :: OSI Approved :: MIT License",
|
"License :: OSI Approved :: MIT License",
|
||||||
|
@ -89,6 +101,4 @@ setup(
|
||||||
"lokrez = lokrez:main",
|
"lokrez = lokrez:main",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
options = options,
|
|
||||||
executables = executables,
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue