diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index afa63dacf..84730192e 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -68,7 +68,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-16.04, macos-10.15, windows-2019] + os: [ubuntu-latest, macos-10.15, windows-2019] steps: - uses: actions/checkout@v2 with: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 409633072..99a6a43ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,7 +82,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-16.04, macos-10.15, windows-2019] + os: [ubuntu-latest, macos-10.15, windows-2019] steps: - uses: actions/checkout@v2 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index fdc0803d3..0d78e634b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed * Download instruction in README.md (wording suggested by https://github.com/philh7456) +* Make Linux binary statically linked ## [3.0.1] - 2021-08-09 diff --git a/noxfile.py b/noxfile.py index 3c3746c3e..23d3e327d 100644 --- a/noxfile.py +++ b/noxfile.py @@ -25,10 +25,15 @@ PY_PATHS = ['b2', 'test', 'noxfile.py', 'setup.py'] +SYSTEM = platform.system().lower() + REQUIREMENTS_FORMAT = ['yapf==0.27'] REQUIREMENTS_LINT = ['yapf==0.27', 'pyflakes==2.2.0', 'pytest==6.1.1', 'liccheck==0.4.7'] REQUIREMENTS_TEST = ['pytest==6.1.1', 'pytest-cov==2.10.1'] REQUIREMENTS_BUILD = ['setuptools>=20.2'] +REQUIREMENTS_BUNDLE = ['pyinstaller'] +if SYSTEM == 'linux': + REQUIREMENTS_BUNDLE.extend(['patchelf-wrapper', 'staticx']) OSX_BUNDLE_IDENTIFIER = 'com.backblaze.b2' OSX_BUNDLE_ENTITLEMENTS = 'contrib/macos/entitlements.plist' @@ -177,24 +182,26 @@ def build(session): @nox.session(python=PYTHON_DEFAULT_VERSION) def bundle(session): """Bundle the distribution.""" - session.install('pyinstaller') + session.install(*REQUIREMENTS_BUNDLE) session.run('rm', '-rf', 'build', 'dist', 'b2.egg-info', external=True) install_myself(session) - system = platform.system().lower() - - if system == 'darwin': + if SYSTEM == 'darwin': session.posargs.extend(['--osx-bundle-identifier', OSX_BUNDLE_IDENTIFIER]) session.run('pyinstaller', '--onefile', *session.posargs, 'b2.spec') + if SYSTEM == 'linux': + session.run('staticx', '--no-compress', '--loglevel', 'INFO', 'dist/b2', 'dist/b2-static') + session.run('mv', '-f', 'dist/b2-static', 'dist/b2', external=True) + # Set outputs for GitHub Actions if CI: asset_path = glob('dist/*')[0] print('::set-output name=asset_path::', asset_path, sep='') name, ext = os.path.splitext(os.path.basename(asset_path)) - asset_name = '{}-{}{}'.format(name, system, ext) + asset_name = '{}-{}{}'.format(name, SYSTEM, ext) print('::set-output name=asset_name::', asset_name, sep='')