Added --arch-pkg option to package.py
Otherwise, AUR packages don't work with Arch lookalikes like Manjaro.
This commit is contained in:
parent
6e7b95b2cf
commit
79800bc6ed
|
@ -2,8 +2,8 @@
|
|||
# Created On: 2009-03-03
|
||||
# Copyright 2014 Hardcoded Software (http://www.hardcoded.net)
|
||||
|
||||
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||
# which should be included with this package. The terms are also available at
|
||||
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
"""This module is a collection of function to help in HS apps build process.
|
||||
|
@ -96,7 +96,7 @@ def filereplace(filename, outfilename=None, **kwargs):
|
|||
fp.close()
|
||||
# We can't use str.format() because in some files, there might be {} characters that mess with it.
|
||||
for key, item in kwargs.items():
|
||||
contents = contents.replace('{{{}}}'.format(key), item)
|
||||
contents = contents.replace('{{{}}}'.format(key), item)
|
||||
fp = open(outfilename, 'wt', encoding='utf-8')
|
||||
fp.write(contents)
|
||||
fp.close()
|
||||
|
@ -106,12 +106,22 @@ def get_module_version(modulename):
|
|||
return mod.__version__
|
||||
|
||||
def setup_package_argparser(parser):
|
||||
parser.add_argument('--sign', dest='sign_identity',
|
||||
help="Sign app under specified identity before packaging (OS X only)")
|
||||
parser.add_argument('--nosign', action='store_true', dest='nosign',
|
||||
help="Don't sign the packaged app (OS X only)")
|
||||
parser.add_argument('--src-pkg', action='store_true', dest='src_pkg',
|
||||
help="Build a tar.gz of the current source.")
|
||||
parser.add_argument(
|
||||
'--sign', dest='sign_identity',
|
||||
help="Sign app under specified identity before packaging (OS X only)"
|
||||
)
|
||||
parser.add_argument(
|
||||
'--nosign', action='store_true', dest='nosign',
|
||||
help="Don't sign the packaged app (OS X only)"
|
||||
)
|
||||
parser.add_argument(
|
||||
'--src-pkg', action='store_true', dest='src_pkg',
|
||||
help="Build a tar.gz of the current source."
|
||||
)
|
||||
parser.add_argument(
|
||||
'--arch-pkg', action='store_true', dest='arch_pkg',
|
||||
help="Force Arch Linux packaging type, regardless of distro name."
|
||||
)
|
||||
|
||||
# `args` come from an ArgumentParser updated with setup_package_argparser()
|
||||
def package_cocoa_app_in_dmg(app_path, destfolder, args):
|
||||
|
@ -131,7 +141,7 @@ def package_cocoa_app_in_dmg(app_path, destfolder, args):
|
|||
|
||||
def build_dmg(app_path, destfolder):
|
||||
"""Builds a DMG volume with application at ``app_path`` and puts it in ``dest_path``.
|
||||
|
||||
|
||||
The name of the resulting DMG volume is determined by the app's name and version.
|
||||
"""
|
||||
print(repr(op.join(app_path, 'Contents', 'Info.plist')))
|
||||
|
@ -176,7 +186,7 @@ def add_to_pythonpath(path):
|
|||
# from there.
|
||||
def copy_packages(packages_names, dest, create_links=False, extra_ignores=None):
|
||||
"""Copy python packages ``packages_names`` to ``dest``, spurious data.
|
||||
|
||||
|
||||
Copy will happen without tests, testdata, mercurial data or C extension module source with it.
|
||||
``py2app`` include and exclude rules are **quite** funky, and doing this is the only reliable
|
||||
way to make sure we don't end up with useless stuff in our app.
|
||||
|
@ -223,7 +233,7 @@ def copy_qt_plugins(folder_names, dest): # This is only for Windows
|
|||
def build_debian_changelog(changelogpath, destfile, pkgname, from_version=None,
|
||||
distribution='precise', fix_version=None):
|
||||
"""Builds a debian changelog out of a YAML changelog.
|
||||
|
||||
|
||||
Use fix_version to patch the top changelog to that version (if, for example, there was a
|
||||
packaging error and you need to quickly fix it)
|
||||
"""
|
||||
|
@ -233,7 +243,7 @@ def build_debian_changelog(changelogpath, destfile, pkgname, from_version=None,
|
|||
desc = desc.replace(' ', ' ')
|
||||
result = desc.split('*')
|
||||
return [s.strip() for s in result if s.strip()]
|
||||
|
||||
|
||||
ENTRY_MODEL = "{pkg} ({version}~{distribution}) {distribution}; urgency=low\n\n{changes}\n -- Virgil Dupras <hsoft@hardcoded.net> {date}\n\n"
|
||||
CHANGE_MODEL = " * {description}\n"
|
||||
changelogs = read_changelog_file(changelogpath)
|
||||
|
@ -269,7 +279,7 @@ def read_changelog_file(filename):
|
|||
date = next(it)
|
||||
description = next(it)
|
||||
yield version, date, description
|
||||
|
||||
|
||||
with open(filename, 'rt', encoding='utf-8') as fp:
|
||||
contents = fp.read()
|
||||
splitted = re_changelog_header.split(contents)[1:] # the first item is empty
|
||||
|
@ -289,7 +299,7 @@ class OSXAppStructure:
|
|||
self.resources = op.join(self.contents, 'Resources')
|
||||
self.frameworks = op.join(self.contents, 'Frameworks')
|
||||
self.infoplist = op.join(self.contents, 'Info.plist')
|
||||
|
||||
|
||||
def create(self, infoplist):
|
||||
ensure_empty_folder(self.dest)
|
||||
os.makedirs(self.macos)
|
||||
|
@ -297,24 +307,24 @@ class OSXAppStructure:
|
|||
os.mkdir(self.frameworks)
|
||||
copy(infoplist, self.infoplist)
|
||||
open(op.join(self.contents, 'PkgInfo'), 'wt').write("APPLxxxx")
|
||||
|
||||
|
||||
def copy_executable(self, executable):
|
||||
info = plistlib.readPlist(self.infoplist)
|
||||
self.executablename = info['CFBundleExecutable']
|
||||
self.executablepath = op.join(self.macos, self.executablename)
|
||||
copy(executable, self.executablepath)
|
||||
|
||||
|
||||
def copy_resources(self, *resources, use_symlinks=False):
|
||||
for path in resources:
|
||||
resource_dest = op.join(self.resources, op.basename(path))
|
||||
action = symlink if use_symlinks else copy
|
||||
action(op.abspath(path), resource_dest)
|
||||
|
||||
|
||||
def copy_frameworks(self, *frameworks):
|
||||
for path in frameworks:
|
||||
framework_dest = op.join(self.frameworks, op.basename(path))
|
||||
copy(path, framework_dest)
|
||||
|
||||
|
||||
|
||||
def create_osx_app_structure(dest, executable, infoplist, resources=None, frameworks=None,
|
||||
symlink_resources=False):
|
||||
|
@ -338,7 +348,7 @@ class OSXFrameworkStructure:
|
|||
self.headers = op.join(self.contents, 'Headers')
|
||||
self.infoplist = op.join(self.resources, 'Info.plist')
|
||||
self._update_executable_path()
|
||||
|
||||
|
||||
def _update_executable_path(self):
|
||||
if not op.exists(self.infoplist):
|
||||
self.executablename = self.executablepath = None
|
||||
|
@ -346,7 +356,7 @@ class OSXFrameworkStructure:
|
|||
info = plistlib.readPlist(self.infoplist)
|
||||
self.executablename = info['CFBundleExecutable']
|
||||
self.executablepath = op.join(self.contents, self.executablename)
|
||||
|
||||
|
||||
def create(self, infoplist):
|
||||
ensure_empty_folder(self.dest)
|
||||
os.makedirs(self.contents)
|
||||
|
@ -354,7 +364,7 @@ class OSXFrameworkStructure:
|
|||
os.mkdir(self.headers)
|
||||
copy(infoplist, self.infoplist)
|
||||
self._update_executable_path()
|
||||
|
||||
|
||||
def create_symlinks(self):
|
||||
# Only call this after create() and copy_executable()
|
||||
rel = lambda path: op.relpath(path, self.dest)
|
||||
|
@ -362,22 +372,22 @@ class OSXFrameworkStructure:
|
|||
os.symlink(rel(self.executablepath), op.join(self.dest, self.executablename))
|
||||
os.symlink(rel(self.headers), op.join(self.dest, 'Headers'))
|
||||
os.symlink(rel(self.resources), op.join(self.dest, 'Resources'))
|
||||
|
||||
|
||||
def copy_executable(self, executable):
|
||||
copy(executable, self.executablepath)
|
||||
|
||||
|
||||
def copy_resources(self, *resources, use_symlinks=False):
|
||||
for path in resources:
|
||||
resource_dest = op.join(self.resources, op.basename(path))
|
||||
action = symlink if use_symlinks else copy
|
||||
action(op.abspath(path), resource_dest)
|
||||
|
||||
|
||||
def copy_headers(self, *headers, use_symlinks=False):
|
||||
for path in headers:
|
||||
header_dest = op.join(self.headers, op.basename(path))
|
||||
action = symlink if use_symlinks else copy
|
||||
action(op.abspath(path), header_dest)
|
||||
|
||||
|
||||
|
||||
def build_cocoalib_xibless(dest='cocoa/autogen'):
|
||||
import xibless
|
||||
|
@ -415,7 +425,7 @@ def collect_stdlib_dependencies(script, dest_folder, extra_deps=None):
|
|||
if not (path.startswith(sysprefix) or path.startswith(real_lib_prefix)):
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
ensure_folder(dest_folder)
|
||||
mf = modulefinder.ModuleFinder()
|
||||
mf.run_script(script)
|
||||
|
|
|
@ -214,7 +214,10 @@ def main():
|
|||
if ISWINDOWS:
|
||||
package_windows(edition, dev)
|
||||
elif ISLINUX:
|
||||
distname, _, _ = platform.dist()
|
||||
if not args.arch_pkg:
|
||||
distname, _, _ = platform.dist()
|
||||
else:
|
||||
distname = 'arch'
|
||||
if distname == 'arch':
|
||||
package_arch(edition)
|
||||
else:
|
||||
|
@ -224,3 +227,4 @@ def main():
|
|||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
||||
|
|
Loading…
Reference in New Issue