Move MacOS plist info back to a template file, and simplify stuff in setup.py
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
setup.iss
|
setup.iss
|
||||||
/novelwriter.desktop
|
/novelwriter.desktop
|
||||||
/novelWriter.pyw
|
/novelWriter.pyw
|
||||||
|
/setup/macos/Info.plist
|
||||||
|
|
||||||
# Translations
|
# Translations
|
||||||
/novelwriter/assets/i18n/*.qm
|
/novelwriter/assets/i18n/*.qm
|
||||||
|
|||||||
@@ -71,25 +71,6 @@ def extractVersion():
|
|||||||
|
|
||||||
return numVers, hexVers, relDate
|
return numVers, hexVers, relDate
|
||||||
|
|
||||||
def extractCopyright():
|
|
||||||
"""Extract the novelWriter copyright notice without having to import
|
|
||||||
anything else from the main package.
|
|
||||||
"""
|
|
||||||
copyright = "Unknown"
|
|
||||||
initFile = os.path.join("novelwriter", "__init__.py")
|
|
||||||
try:
|
|
||||||
with open(initFile, mode="r", encoding="utf-8") as inFile:
|
|
||||||
for aLine in inFile:
|
|
||||||
if aLine.startswith("__copyright__"):
|
|
||||||
copyright = (aLine).partition("=")[2].strip().strip('"')
|
|
||||||
except Exception as exc:
|
|
||||||
print("Could not read file: %s" % initFile)
|
|
||||||
print(str(exc))
|
|
||||||
|
|
||||||
print("novelWriter copyright: %s " % (copyright))
|
|
||||||
|
|
||||||
return copyright
|
|
||||||
|
|
||||||
|
|
||||||
def compactVersion(numVers):
|
def compactVersion(numVers):
|
||||||
"""Make the version number more compact."""
|
"""Make the version number more compact."""
|
||||||
@@ -414,102 +395,36 @@ def buildQtI18nTS(sysArgs):
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Generage MacOS PList
|
# Generage MacOS PList
|
||||||
##
|
##
|
||||||
|
|
||||||
def genMacOSPlist():
|
def genMacOSPlist():
|
||||||
|
"""Set necessary values for .plist file.
|
||||||
# Set Up Folder
|
"""
|
||||||
# =============
|
|
||||||
|
|
||||||
numVers, _, _ = extractVersion()
|
numVers, _, _ = extractVersion()
|
||||||
pkgVers = compactVersion(numVers)
|
pkgVers = compactVersion(numVers)
|
||||||
|
|
||||||
outDir = "setup/macos"
|
outDir = "setup/macos"
|
||||||
|
|
||||||
macosBundleName = "novelWriter"
|
copyrightYear = datetime.datetime.now().year
|
||||||
macosBundleExeName = "novelWriter"
|
|
||||||
macosBundleInfo = "novelWriter: A markdown-like text editor for planning and writing novels."
|
|
||||||
macosBundleIcon = "novelwriter.icns"
|
|
||||||
macosBundleIdent = "io.novelwriter.novelWriter"
|
|
||||||
macosBundleSVers = pkgVers
|
|
||||||
macosBundleVers = numVers
|
|
||||||
macosBundleCopyright = extractCopyright()
|
|
||||||
|
|
||||||
# These keys are no longer used but are present for compatability
|
# These keys are no longer used but are present for compatability
|
||||||
macosBundleVersMajor, macosBundleVersMinor, _ = pkgVers.split(".")
|
pkgVersMaj, pkgVersMin, _ = pkgVers.split(".")
|
||||||
|
|
||||||
|
plistXML = readFile(f"{outDir}/Info.plist.template").format(
|
||||||
plistXML = (
|
macosBundleSVers=pkgVers,
|
||||||
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
macosBundleVers=numVers,
|
||||||
"<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n"
|
macosBundleVersMajor=pkgVersMaj,
|
||||||
"<plist version=\"1.0\">\n"
|
macosBundleVersMinor=pkgVersMin,
|
||||||
"<dict>\n"
|
macosBundleCopyright=f"Copyright 2018–{copyrightYear}, Veronica Berglyd Olsen",
|
||||||
"<key>NSPrincipalClass</key>\n"
|
|
||||||
"<string>NSApplication</string>\n"
|
|
||||||
"<key>NSHighResolutionCapable</key>\n"
|
|
||||||
"<string>True</string>\n"
|
|
||||||
"<key>CFBundleDevelopmentRegion</key>\n"
|
|
||||||
"<string>English</string>\n"
|
|
||||||
"<key>CFBundleExecutable</key>\n"
|
|
||||||
f"<string>{macosBundleExeName}</string>\n"
|
|
||||||
"<key>CFBundleGetInfoString</key>\n"
|
|
||||||
f"<string>{macosBundleInfo}</string>\n"
|
|
||||||
"<key>CFBundleIconFile</key>\n"
|
|
||||||
f"<string>{macosBundleIcon}</string>\n"
|
|
||||||
"<key>CFBundleIdentifier</key>\n"
|
|
||||||
f"<string>{macosBundleIdent}</string>\n"
|
|
||||||
"<key>CFBundleName</key>\n"
|
|
||||||
f"<string>{macosBundleName}</string>\n"
|
|
||||||
"<key>CFBundleDisplayName</key>\n"
|
|
||||||
f"<string>{macosBundleName}</string>\n"
|
|
||||||
"<key>CFBundleInfoDictionaryVersion</key>\n"
|
|
||||||
"<string>6.0</string>\n"
|
|
||||||
"<key>CFBundleShortVersionString</key>\n"
|
|
||||||
f"<string>{macosBundleSVers}</string>\n"
|
|
||||||
"<key>CFBundleSignature</key>\n"
|
|
||||||
"<string>????</string>\n"
|
|
||||||
"<key>CFBundleVersion</key>\n"
|
|
||||||
f"<string>{macosBundleVers}</string>\n"
|
|
||||||
"<key>CFBundlePackageType</key>\n"
|
|
||||||
"<string>APPL</string>\n"
|
|
||||||
"<key>NSHumanReadableCopyright</key>\n"
|
|
||||||
f"<string>{macosBundleCopyright}</string>\n"
|
|
||||||
"<key>IFMajorVersion</key>\n"
|
|
||||||
f"<integer>{macosBundleVersMajor}</integer>\n"
|
|
||||||
"<key>IFMinorVersion</key>\n"
|
|
||||||
f"<integer>{macosBundleVersMinor}</integer>\n"
|
|
||||||
"<key>CFBundleDocumentTypes</key>\n"
|
|
||||||
" <array>\n"
|
|
||||||
" <dict>\n"
|
|
||||||
" <key>CFBundleTypeExtensions</key>\n"
|
|
||||||
" <array>\n"
|
|
||||||
" <string>nwx</string>\n"
|
|
||||||
" </array>\n"
|
|
||||||
" <key>CFBundleTypeName</key>\n"
|
|
||||||
" <string>novelWriter Project</string>\n"
|
|
||||||
" <key>CFBundleTypeOSTypes</key>\n"
|
|
||||||
" <array>\n"
|
|
||||||
" <string>TEXT</string>\n"
|
|
||||||
" <string>utxt</string>\n"
|
|
||||||
" <string>TUTX</string>\n"
|
|
||||||
" <string>****</string>\n"
|
|
||||||
" </array>\n"
|
|
||||||
" <key>CFBundleTypeRole</key>\n"
|
|
||||||
" <string>Viewer</string>\n"
|
|
||||||
" <key>LSHandlerRank</key>\n"
|
|
||||||
" <string>Alternate</string>\n"
|
|
||||||
" </dict>\n"
|
|
||||||
" </array>\n"
|
|
||||||
"</dict>\n"
|
|
||||||
"</plist>\n"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
print(f"Writing Info.plist to {outDir}/Info.plist")
|
print(f"Writing Info.plist to {outDir}/Info.plist")
|
||||||
|
|
||||||
writeFile(f"{outDir}/Info.plist", plistXML)
|
writeFile(f"{outDir}/Info.plist", plistXML)
|
||||||
|
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Sample Project ZIP File Builder (sample)
|
# Sample Project ZIP File Builder (sample)
|
||||||
@@ -2059,7 +1974,7 @@ if __name__ == "__main__":
|
|||||||
if "clean-assets" in sys.argv:
|
if "clean-assets" in sys.argv:
|
||||||
sys.argv.remove("clean-assets")
|
sys.argv.remove("clean-assets")
|
||||||
cleanBuiltAssets()
|
cleanBuiltAssets()
|
||||||
|
|
||||||
if "gen-plist" in sys.argv:
|
if "gen-plist" in sys.argv:
|
||||||
sys.argv.remove("gen-plist")
|
sys.argv.remove("gen-plist")
|
||||||
genMacOSPlist()
|
genMacOSPlist()
|
||||||
|
|||||||
@@ -7,4 +7,4 @@
|
|||||||
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
|
||||||
<true/>
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>novelWriter</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>novelWriter: A markdown-like text editor for planning and writing novels.</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>novelwriter.icns</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>io.novelwriter.novelWriter</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>novelWriter</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>novelWriter</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>{macosBundleSVers}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>{macosBundleVers}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>{macosBundleCopyright}</string>
|
||||||
|
<key>IFMajorVersion</key>
|
||||||
|
<integer>{macosBundleVersMajor}</integer>
|
||||||
|
<key>IFMinorVersion</key>
|
||||||
|
<integer>{macosBundleVersMinor}</integer>
|
||||||
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
<array>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>nwx</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>novelWriter Project</string>
|
||||||
|
<key>CFBundleTypeOSTypes</key>
|
||||||
|
<array>
|
||||||
|
<string>TEXT</string>
|
||||||
|
<string>utxt</string>
|
||||||
|
<string>TUTX</string>
|
||||||
|
<string>****</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
<key>LSHandlerRank</key>
|
||||||
|
<string>Alternate</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
Reference in New Issue
Block a user