mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-23 20:15:19 -07:00
Format
This commit is contained in:
parent
2b43b3a829
commit
05413d4ad3
@ -42,6 +42,7 @@ LIBRARY = 'libsodium'
|
||||
|
||||
DOCKER = 'sudo docker'
|
||||
|
||||
|
||||
class Version:
|
||||
|
||||
def __init__(self, libsodium_version, package_version):
|
||||
@ -50,19 +51,28 @@ class Version:
|
||||
|
||||
self.builddir = os.path.join(BUILDDIR, libsodium_version)
|
||||
self.tempdir = os.path.join(TEMPDIR, libsodium_version)
|
||||
self.projfile = os.path.join(self.builddir, '{0}.{1}.pkgproj'.format(PACKAGE, package_version))
|
||||
self.propsfile = os.path.join(self.builddir, '{0}.props'.format(PACKAGE))
|
||||
self.pkgfile = os.path.join(BUILDDIR, '{0}.{1}.nupkg'.format(PACKAGE, package_version))
|
||||
self.projfile = os.path.join(
|
||||
self.builddir, '{0}.{1}.pkgproj'.format(PACKAGE, package_version))
|
||||
self.propsfile = os.path.join(
|
||||
self.builddir, '{0}.props'.format(PACKAGE))
|
||||
self.pkgfile = os.path.join(
|
||||
BUILDDIR, '{0}.{1}.nupkg'.format(PACKAGE, package_version))
|
||||
|
||||
|
||||
class WindowsItem:
|
||||
|
||||
def __init__(self, version, rid, platform):
|
||||
self.url = 'https://download.libsodium.org/libsodium/releases/libsodium-{0}-msvc.zip'.format(version.libsodium_version)
|
||||
self.cachefile = os.path.join(CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url))
|
||||
self.packfile = os.path.join(version.builddir, 'runtimes', rid, 'native', LIBRARY + '.dll')
|
||||
self.itemfile = '{0}/Release/v140/dynamic/libsodium.dll'.format(platform)
|
||||
self.url = 'https://download.libsodium.org/libsodium/releases/libsodium-{0}-msvc.zip'.format(
|
||||
version.libsodium_version)
|
||||
self.cachefile = os.path.join(
|
||||
CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url))
|
||||
self.packfile = os.path.join(
|
||||
version.builddir, 'runtimes', rid, 'native', LIBRARY + '.dll')
|
||||
self.itemfile = '{0}/Release/v140/dynamic/libsodium.dll'.format(
|
||||
platform)
|
||||
self.tempdir = os.path.join(version.tempdir, rid)
|
||||
self.tempfile = os.path.join(self.tempdir, os.path.normpath(self.itemfile))
|
||||
self.tempfile = os.path.join(
|
||||
self.tempdir, os.path.normpath(self.itemfile))
|
||||
|
||||
def make(self, f):
|
||||
f.write('\n')
|
||||
@ -78,15 +88,21 @@ class WindowsItem:
|
||||
self.itemfile
|
||||
))
|
||||
|
||||
|
||||
class MacOSItem:
|
||||
|
||||
def __init__(self, version, rid, codename):
|
||||
self.url = 'https://bintray.com/homebrew/bottles/download_file?file_path=libsodium-{0}.{1}.bottle.tar.gz'.format(version.libsodium_version, codename)
|
||||
self.cachefile = os.path.join(CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url))
|
||||
self.packfile = os.path.join(version.builddir, 'runtimes', rid, 'native', LIBRARY + '.dylib')
|
||||
self.itemfile = 'libsodium/{0}/lib/libsodium.dylib'.format(version.libsodium_version)
|
||||
self.url = 'https://bintray.com/homebrew/bottles/download_file?file_path=libsodium-{0}.{1}.bottle.tar.gz'.format(
|
||||
version.libsodium_version, codename)
|
||||
self.cachefile = os.path.join(
|
||||
CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url))
|
||||
self.packfile = os.path.join(
|
||||
version.builddir, 'runtimes', rid, 'native', LIBRARY + '.dylib')
|
||||
self.itemfile = 'libsodium/{0}/lib/libsodium.dylib'.format(
|
||||
version.libsodium_version)
|
||||
self.tempdir = os.path.join(version.tempdir, rid)
|
||||
self.tempfile = os.path.join(self.tempdir, os.path.normpath(self.itemfile))
|
||||
self.tempfile = os.path.join(
|
||||
self.tempdir, os.path.normpath(self.itemfile))
|
||||
|
||||
def make(self, f):
|
||||
f.write('\n')
|
||||
@ -102,12 +118,16 @@ class MacOSItem:
|
||||
os.path.dirname(self.itemfile)
|
||||
))
|
||||
|
||||
|
||||
class LinuxItem:
|
||||
|
||||
def __init__(self, version, rid, docker_image):
|
||||
self.url = 'https://download.libsodium.org/libsodium/releases/libsodium-{0}.tar.gz'.format(version.libsodium_version)
|
||||
self.cachefile = os.path.join(CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url))
|
||||
self.packfile = os.path.join(version.builddir, 'runtimes', rid, 'native', LIBRARY + '.so')
|
||||
self.url = 'https://download.libsodium.org/libsodium/releases/libsodium-{0}.tar.gz'.format(
|
||||
version.libsodium_version)
|
||||
self.cachefile = os.path.join(
|
||||
CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url))
|
||||
self.packfile = os.path.join(
|
||||
version.builddir, 'runtimes', rid, 'native', LIBRARY + '.so')
|
||||
self.tempdir = os.path.join(version.tempdir, rid)
|
||||
self.tempfile = os.path.join(self.tempdir, 'libsodium.so')
|
||||
self.docker_image = docker_image
|
||||
@ -116,7 +136,8 @@ class LinuxItem:
|
||||
def make(self, f):
|
||||
recipe = self.recipe
|
||||
while not os.path.exists(os.path.join('recipes', recipe)):
|
||||
m = re.fullmatch(r'([^.-]+)((([.][^.-]+)*)[.][^.-]+)?([-].*)?', recipe)
|
||||
m = re.fullmatch(
|
||||
r'([^.-]+)((([.][^.-]+)*)[.][^.-]+)?([-].*)?', recipe)
|
||||
if m.group(5) is None:
|
||||
recipe = 'build'
|
||||
break
|
||||
@ -138,15 +159,20 @@ class LinuxItem:
|
||||
'-v $(abspath $(dir $@)):/io/output ' +
|
||||
'{0} sh -x -e /io/recipes/{1}\n'.format(self.docker_image, recipe))
|
||||
|
||||
|
||||
class ExtraItem:
|
||||
|
||||
def __init__(self, version, filename):
|
||||
self.url = 'https://download.libsodium.org/libsodium/releases/libsodium-{0}.tar.gz'.format(version.libsodium_version)
|
||||
self.cachefile = os.path.join(CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url))
|
||||
self.url = 'https://download.libsodium.org/libsodium/releases/libsodium-{0}.tar.gz'.format(
|
||||
version.libsodium_version)
|
||||
self.cachefile = os.path.join(
|
||||
CACHEDIR, re.sub(r'[^A-Za-z0-9.]', '-', self.url))
|
||||
self.packfile = os.path.join(version.builddir, filename)
|
||||
self.itemfile = 'libsodium-{0}/{1}'.format(version.libsodium_version, filename)
|
||||
self.itemfile = 'libsodium-{0}/{1}'.format(
|
||||
version.libsodium_version, filename)
|
||||
self.tempdir = os.path.join(version.tempdir, 'extras')
|
||||
self.tempfile = os.path.join(self.tempdir, os.path.normpath(self.itemfile))
|
||||
self.tempfile = os.path.join(
|
||||
self.tempdir, os.path.normpath(self.itemfile))
|
||||
|
||||
def make(self, f):
|
||||
f.write('\n')
|
||||
@ -162,8 +188,10 @@ class ExtraItem:
|
||||
self.itemfile
|
||||
))
|
||||
|
||||
|
||||
def main(args):
|
||||
m = re.fullmatch(r'((\d+\.\d+\.\d+)(\.\d+)?)(?:-(\w+(?:[_.-]\w+)*))?', args[1]) if len(args) == 2 else None
|
||||
m = re.fullmatch(
|
||||
r'((\d+\.\d+\.\d+)(\.\d+)?)(?:-(\w+(?:[_.-]\w+)*))?', args[1]) if len(args) == 2 else None
|
||||
|
||||
if m is None:
|
||||
print('Usage:')
|
||||
@ -220,8 +248,10 @@ def main(args):
|
||||
f.write('{0}:'.format(version.pkgfile))
|
||||
f.write(' \\\n\t\t{0}'.format(version.projfile))
|
||||
f.write(' \\\n\t\t{0}'.format(version.propsfile))
|
||||
|
||||
for item in items:
|
||||
f.write(' \\\n\t\t{0}'.format(item.packfile))
|
||||
|
||||
f.write('\n')
|
||||
f.write('\t@mkdir -p $(dir $@)\n')
|
||||
f.write('\t{0} run --rm '.format(DOCKER) +
|
||||
@ -237,8 +267,10 @@ def main(args):
|
||||
'-v $(abspath $(dir $<)):/io/packages ' +
|
||||
'{0} sh -x -e /io/recipes/{1} "{2}"\n'.format('microsoft/dotnet:2.0-sdk', 'test', version.package_version))
|
||||
|
||||
print('prepared', MAKEFILE, 'to make', version.pkgfile, 'for libsodium', version.libsodium_version)
|
||||
print('prepared', MAKEFILE, 'to make', version.pkgfile,
|
||||
'for libsodium', version.libsodium_version)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
|
Loading…
Reference in New Issue
Block a user