Skip to content

Commit

Permalink
feat(make): improve local cleanup and installation (#24)
Browse files Browse the repository at this point in the history
* feat(make): improve locally cleanup and installation

* feat(version): add cli command line version
  • Loading branch information
alissonperez committed Mar 14, 2024
1 parent 71bf52c commit 9598c50
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@

cleanup:
rm -rf dist
pip uninstall gpt-pr --yes

requirements:
pipenv requirements > requirements.txt

install:
python setup.py install
install: cleanup requirements
python setup.py clean --all
pip install .

build: cleanup requirements
@echo "Building..."
Expand Down
7 changes: 6 additions & 1 deletion gptpr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
from gptpr.gitutil import get_branch_info
from gptpr.gh import create_pr
from gptpr.prdata import get_pr_data
from gptpr.version import __version__


def run(base_branch='main', yield_confirmation=False):
def run(base_branch='main', yield_confirmation=False, version=False):
'''
Create Pull Requests from current branch with base branch (default 'main' branch)
'''

if version:
print('Current version:', __version__)
return

branch_info = get_branch_info(base_branch, yield_confirmation)

if not branch_info:
Expand Down
3 changes: 3 additions & 0 deletions gptpr/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is generated automatically when package is released

__version__ = 'n/d'
7 changes: 7 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ def get_requirements():
raise Exception('VERSION environment variable not set')


def write_version(current_version):
with open('gptpr/version.py', 'w') as f:
f.write(f'__version__ = "{current_version}"\n')


write_version(version)

setup(name='gpt-pr',
version=version,
python_requires='>=3.7',
Expand Down

0 comments on commit 9598c50

Please sign in to comment.