Skip to content

Commit

Permalink
Merge pull request #178 from reef-technologies/setuptools-scm
Browse files Browse the repository at this point in the history
Use setuptools-scm
  • Loading branch information
mlech-reef authored Jan 13, 2021
2 parents 0cd994c + 4305002 commit 57e5a6a
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 79 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
uses: actions/setup-python@v2
with:
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
uses: actions/setup-python@v2
with:
Expand All @@ -33,6 +35,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -61,6 +65,8 @@ jobs:
python-version: pypy3
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
Expand Down Expand Up @@ -91,6 +97,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python ${{ env.PYTHON_DEFAULT_VERSION }}
uses: actions/setup-python@v2
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed
* Fix missing import in the synchronization example
* Use setuptools-scm for versioning

## [1.2.0] - 2020-11-03

Expand Down
4 changes: 0 additions & 4 deletions README.release.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

- Get the Nox:
- `pip install -U nox`
- Bump the version number to an even number in `b2sdk/version.py`.
- Update the release history in `CHANGELOG.md`:
- Change "Unreleased" to the current release version and date.
- Create empty "Unreleased" section.
Expand All @@ -24,6 +23,3 @@
- Verify that the release has been uploaded to the PyPI
- Install using pip and verify that it gets the correct version:
- `pip install -U b2sdk`
- Update for dev:
- Bump the version number to an odd number (for example: 1.0.2 -> 1.0.3)
- Commit the changes and push to GitHub again.
20 changes: 20 additions & 0 deletions b2sdk/_pyinstaller/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
######################################################################
#
# File: b2sdk/_pyinstaller/__init__.py
#
# Copyright 2021 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################

import os


def get_hook_dirs():
"""Get hooks directories for pyinstaller.
More info about the hooks:
https://pyinstaller.readthedocs.io/en/stable/hooks.html
"""
return [os.path.dirname(__file__)]
13 changes: 13 additions & 0 deletions b2sdk/_pyinstaller/hook-b2sdk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
######################################################################
#
# File: b2sdk/_pyinstaller/hook-b2sdk.py
#
# Copyright 2021 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################

from PyInstaller.utils.hooks import copy_metadata

datas = copy_metadata('b2sdk')
12 changes: 7 additions & 5 deletions b2sdk/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@

import sys

# To avoid confusion between official Backblaze releases of this tool and
# the versions on Github, we use the convention that the third number is
# odd for Github, and even for Backblaze releases.
VERSION = '1.2.1'
try:
from importlib.metadata import version
except ImportError: # ModuleNotFoundError is not available in Python 3.5
from importlib_metadata import version

PYTHON_VERSION = '.'.join(map(str, sys.version_info[:3])) # something like: 2.7.11
VERSION = version('b2sdk')

PYTHON_VERSION = '.'.join(map(str, sys.version_info[:3])) # something like: 3.9.1

USER_AGENT = 'backblaze-b2/%s python/%s' % (VERSION, PYTHON_VERSION)
30 changes: 0 additions & 30 deletions doc/source/missing.txt

This file was deleted.

33 changes: 0 additions & 33 deletions doc/source/remarks.txt

This file was deleted.

2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
arrow>=0.8.0,<1.0.0; python_version <= '3.5'
arrow>=0.8.0; python_version > '3.5'
importlib-metadata>=2.1.1,<3.0.0; python_version <= '3.5'
importlib-metadata>=3.3.0; python_version > '3.5' and python_version < '3.8'
logfury>=0.1.2
requests>=2.9.1
tqdm>=4.5.0
16 changes: 9 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,8 @@
with open('requirements.txt', encoding='utf-8') as f:
requirements = f.read().splitlines()

version = import_module('b2sdk').__version__

setup(
name='b2sdk',

# Versions should comply with PEP440. For a discussion on single-sourcing
# the version across setup.py and the project code, see
# https://packaging.python.org/en/latest/single_source_version.html
version=version,
description='Backblaze B2 SDK',
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down Expand Up @@ -115,6 +108,8 @@
'sadisplay'
],
},
setup_requires=['setuptools_scm'],
use_scm_version=True,

# If there are data files included in your packages that need to be
# installed, specify them here.
Expand All @@ -127,4 +122,11 @@
data_files=[
#('my_data', ['data/data_file'])
],

# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow
# pip to create the appropriate form of executable for the target platform.
entry_points={
'pyinstaller40': ['hook-dirs=b2sdk._pyinstaller:get_hook_dirs'],
},
)

0 comments on commit 57e5a6a

Please sign in to comment.