Rename git.py to vcs.py to avoid git command conflicts.

main
Alex Huszagh 2022-04-27 16:40:12 -05:00
parent f753556c2c
commit ad10af6fc3
2 changed files with 6 additions and 20 deletions

View File

@ -433,21 +433,21 @@ python configure.py --clean --pyqt6
If no changes are being made to the icons or stylesheets, you may want to ensure that the `dist` directory is assumed to be unchanged in git, no longer tracking changes to these files. You can turn tracking distribution files off with: If no changes are being made to the icons or stylesheets, you may want to ensure that the `dist` directory is assumed to be unchanged in git, no longer tracking changes to these files. You can turn tracking distribution files off with:
```bash ```bash
python git.py --no-track-dist python vcs.py --no-track-dist
``` ```
To turn back on tracking, run: To turn back on tracking, run:
```bash ```bash
python git.py --track-dist python vcs.py --track-dist
``` ```
## Git Ignore ## Git Ignore
Note that the `.gitignore` is auto-generated via `git.py`, and the scripts to track or untrack distribution files turn off `.gitignore` tracking. Any changes should be made in `git.py`, and ensure that `.gitignore` is tracked, and commit any changes: Note that the `.gitignore` is auto-generated via `vcs.py`, and the scripts to track or untrack distribution files turn off `.gitignore` tracking. Any changes should be made in `vcs.py`, and ensure that `.gitignore` is tracked, and commit any changes:
```bash ```bash
python git.py --track-gitignore python vcs.py --track-gitignore
git add .gitignore git add .gitignore
git commit -m "..." git commit -m "..."
``` ```

View File

@ -1,5 +1,5 @@
''' '''
git vcs
=== ===
Track/untrack distribution files. Track/untrack distribution files.
@ -8,7 +8,6 @@
__version__ = '0.1.0' __version__ = '0.1.0'
import argparse import argparse
import contextlib
import errno import errno
import os import os
import shutil import shutil
@ -66,18 +65,6 @@ def parse_args(argv=None):
return parser.parse_args(argv) return parser.parse_args(argv)
@contextlib.contextmanager
def cd_root():
'''Temporarily go to the root directory.'''
cwd = os.getcwd()
try:
os.chdir('/')
yield
finally:
os.chdir(cwd)
def call(command): def call(command):
'''Call subprocess command (ignoring output but checking code).''' '''Call subprocess command (ignoring output but checking code).'''
@ -133,8 +120,7 @@ def main(argv=None):
# Find our git executable. Go to the in case on # Find our git executable. Go to the in case on
# Windows `.py` is added to valid suffixes so # Windows `.py` is added to valid suffixes so
# we don't recursively call this file. # we don't recursively call this file.
with cd_root(): git = shutil.which('git')
git = shutil.which('git')
if git is None: if git is None:
raise FileNotFoundError(errno.ENOENT, "No such file or directory: 'git'") raise FileNotFoundError(errno.ENOENT, "No such file or directory: 'git'")