Skip to content

Commit

Permalink
Add tests that builds from the source dist (#75)
Browse files Browse the repository at this point in the history
* Add tests that builds from the source dist

* Add pyproject.toml and pyx files to manifest

* Remove experimental version augmentation
  • Loading branch information
Erotemic committed Apr 30, 2021
1 parent 1323326 commit 56bd6f9
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 53 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/python-sdist-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: python_sdist_test

on:
push:
branches: [ master, dev/github_actions ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.5, 3.6, 3.7, 3.8, 3.9]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements/build.txt
python -m pip install -r requirements/tests.txt
- name: Build sdist
run: |
python setup.py sdist
- name: Install sdist
run: |
cd dist
ls -al
pip install line_profiler*.tar.gz -v
- name: Test sdist
run: |
pwd
ls -al
# Ensure the source doesn't conflict with the test
rm -rf line_profiler
rm -rf kernprof.py
# cd ..
python run_tests.py
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Changes
=======


3.2.6
~~~~~
* FIX: Update MANIFEST.in to package pyproj.toml and missing pyx file
* CHANGE: Removed version experimental augmentation.

3.2.5
~~~~~
* FIX: Update MANIFEST.in to package nested c source files in the sdist
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ include *.md
include *.rst
include *.py
include *.txt
include *.toml
include run_tests.sh
recursive-include requirements *.txt
recursive-include tests *.py
recursive-include line_profiler *.txt
recursive-include line_profiler *.pyx
recursive-include line_profiler *.pxd
recursive-include line_profiler *.pyd
recursive-include line_profiler *.c
recursive-include line_profiler *.h
2 changes: 1 addition & 1 deletion kernprof.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# NOTE: This version needs to be manually maintained with the line_profiler
# __version__ for now.
__version__ = '3.2.5'
__version__ = '3.2.6'

PY3 = sys.version_info[0] == 3

Expand Down
27 changes: 1 addition & 26 deletions line_profiler/line_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,7 @@
'Has it been compiled? Underlying error is ex={!r}'.format(ex)
)


def _augment_version(VERSION):
from os.path import join, dirname, exists
repo_dpath = join(dirname(dirname(__file__)))
git_dpath = join(repo_dpath, '.git')
if exists(git_dpath):
head_fpath = join(git_dpath, 'HEAD')
with open(head_fpath, 'r') as file:
head_contents = file.read()
part1 = head_contents.split(' ')[0]
if part1 == 'ref:':
ref = head_contents.split('\n')[0].split()[-1]
ref_fpath = join(git_dpath, ref)
with open(ref_fpath, 'r') as file:
ref_hash = file.read().strip()
else:
ref = None
ref_hash = head_contents.split('\n')[0][0:8]
hashid = ref_hash[0:8]
if ref != 'refs/heads/release':
VERSION = VERSION.split('+')[0] + '+' + hashid
return VERSION


__version__ = '3.2.5'
__version__ = _augment_version(__version__)
__version__ = '3.2.6'

# Python 2/3 compatibility utils
# ===========================================================
Expand Down
26 changes: 0 additions & 26 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,32 +192,6 @@ def native_mb_python_tag():
NAME = 'line_profiler'


def _augment_version(VERSION):
from os.path import join, dirname, exists
repo_dpath = join(dirname(__file__))
git_dpath = join(repo_dpath, '.git')
if exists(git_dpath):
head_fpath = join(git_dpath, 'HEAD')
with open(head_fpath, 'r') as file:
head_contents = file.read()
part1 = head_contents.split(' ')[0]
if part1 == 'ref:':
ref = head_contents.split('\n')[0].split()[-1]
ref_fpath = join(git_dpath, ref)
with open(ref_fpath, 'r') as file:
ref_hash = file.read().strip()
else:
ref = None
ref_hash = head_contents.split('\n')[0][0:8]
hashid = ref_hash[0:8]
if ref != 'refs/heads/release':
VERSION = VERSION.split('+')[0] + '+' + hashid
return VERSION


VERSION = _augment_version(VERSION)


if __name__ == '__main__':
if '--universal' in sys.argv:
# Dont use scikit-build for universal wheels
Expand Down

0 comments on commit 56bd6f9

Please sign in to comment.