]>
git.madduck.net Git - etc/vim.git/commitdiff
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
19d69b3 )
-def _find _python_binary(exec_prefix):
+def _get _python_binary(exec_prefix):
if sys.platform[:3] == "win":
return exec_prefix / 'python.exe'
return exec_prefix / 'bin' / 'python3'
if sys.platform[:3] == "win":
return exec_prefix / 'python.exe'
return exec_prefix / 'bin' / 'python3'
-def _find _pip(venv_path):
+def _get _pip(venv_path):
if sys.platform[:3] == "win":
return venv_path / 'Scripts' / 'pip.exe'
return venv_path / 'bin' / 'pip'
if sys.platform[:3] == "win":
return venv_path / 'Scripts' / 'pip.exe'
return venv_path / 'bin' / 'pip'
-def _find_virtualenv_site_packages(venv_path ):
+def _get_virtualenv_site_packages(venv_path, pyver ):
if sys.platform[:3] == "win":
return venv_path / 'Lib' / 'site-packages'
if sys.platform[:3] == "win":
return venv_path / 'Lib' / 'site-packages'
- return venv_path / 'L ib' / f'python{pyver[0]}.{pyver[1]}' / 'site-packages'
+ return venv_path / 'l ib' / f'python{pyver[0]}.{pyver[1]}' / 'site-packages'
def _initialize_black_env(upgrade=False):
pyver = sys.version_info[:2]
def _initialize_black_env(upgrade=False):
pyver = sys.version_info[:2]
import subprocess
import venv
virtualenv_path = Path(vim.eval("g:black_virtualenv")).expanduser()
import subprocess
import venv
virtualenv_path = Path(vim.eval("g:black_virtualenv")).expanduser()
- virtualenv_site_packages = str(_find_virtualenv_site_packages(virtualenv_path ))
+ virtualenv_site_packages = str(_get_virtualenv_site_packages(virtualenv_path, pyver ))
first_install = False
if not virtualenv_path.is_dir():
print('Please wait, one time setup for Black.')
_executable = sys.executable
try:
first_install = False
if not virtualenv_path.is_dir():
print('Please wait, one time setup for Black.')
_executable = sys.executable
try:
- sys.executable = str(_find _python_binary(Path(sys.exec_prefix)))
+ sys.executable = str(_get _python_binary(Path(sys.exec_prefix)))
print(f'Creating a virtualenv in {virtualenv_path}...')
print('(this path can be customized in .vimrc by setting g:black_virtualenv)')
venv.create(virtualenv_path, with_pip=True)
print(f'Creating a virtualenv in {virtualenv_path}...')
print('(this path can be customized in .vimrc by setting g:black_virtualenv)')
venv.create(virtualenv_path, with_pip=True)
if upgrade:
print('Upgrading Black with pip...')
if first_install or upgrade:
if upgrade:
print('Upgrading Black with pip...')
if first_install or upgrade:
- subprocess.run([str(_find _pip(virtualenv_path)), 'install', '-U', 'black'])
+ subprocess.run([str(_get _pip(virtualenv_path)), 'install', '-U', 'black'])
print('DONE! You are all set, thanks for waiting ✨ 🍰 ✨')
if first_install:
print('Pro-tip: to upgrade Black in the future, use the :BlackUpgrade command and restart Vim.\n')
print('DONE! You are all set, thanks for waiting ✨ 🍰 ✨')
if first_install:
print('Pro-tip: to upgrade Black in the future, use the :BlackUpgrade command and restart Vim.\n')