Skip to content

Commit

Permalink
setup.py detect if a wheel install is happening from git
Browse files Browse the repository at this point in the history
Needed in order to trigger the correct packaging of data_files in the
event that someone or something (usually pip with a git url being
using in a Pipfile) tries to build a wheel directly from git. I try to
avoid this build workflow because it is difficult to control what
files end up being packaged, but it can happen, so we support it.

version bump for release
  • Loading branch information
tgbugs committed Feb 19, 2020
1 parent cf44c3d commit e512305
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion protcur/protcur/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.4.dev0'
__version__ = '0.0.4'
11 changes: 7 additions & 4 deletions protcur/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ def find_version(filename):
long_description = f.read()


ru = Path('resources', 'units')
RELEASE = '--release' in sys.argv
if RELEASE:
sys.argv.remove('--release')
WHEEL_FROM_GIT = not ru.exists() and 'bdist_wheel' in sys.argv
if RELEASE or WHEEL_FROM_GIT:
if RELEASE:
sys.argv.remove('--release')

from protcur.config import __anno_tags__, __protc_tags__
from protcur.config import __units_folder__, __units_test_folder__

Expand All @@ -36,7 +40,6 @@ def find_version(filename):
shutil.copy(__anno_tags__, 'resources')
shutil.copy(__protc_tags__, 'resources')

ru = Path('resources', 'units')
if ru.exists(): # release or running from sdist not in git
data_files = [
('share/protcur', ['resources/anno-tags.rkt',
Expand Down Expand Up @@ -85,7 +88,7 @@ def find_version(filename):
data_files=data_files,
)
finally:
if RELEASE:
if RELEASE or WHEEL_FROM_GIT:
shutil.rmtree('resources/units')
Path('resources', __anno_tags__.name).unlink()
Path('resources', __protc_tags__.name).unlink()

0 comments on commit e512305

Please sign in to comment.