zsh-workers
 help / color / mirror / code / Atom feed
cab7fda31fabe0f78d5ebc0e57bf808fd972478a blob 12174 bytes (raw)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
 
#compdef pip

# {{{ common options
local common_options_help=(
	'(- :)'{-h,--help}'[show help]'
)
local common_options_pre=(
	'--pre[Include pre-release and development versions]'
)
local common_options_install=(
	{\*-c,\*--constraint}'[Constrain versions using the given constraints file]:FILE:_files'
	'(- :)'{-e,--editable}'[Install a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url]:PACKAGE:{__pip_package "url" "file"}'
	{\*-r,\*--requirement}'[Install from the given requirements file]:FILE:_files'
	{-b,--build}'[Directory to unpack packages into and build in]:DIRECTORY:_files -/'
	"--no-deps[Don't install package dependencies]"
	"${common_options_pre[@]}"
	'*--global-option=[Extra global options to be supplied to the setup.py call before the install command]:OPTION:_setup.py'
	'*--no-binary[Do not use binary packages]:FORMAT_CONTROL:__pip_no_binary_control'
	'*--only-binary[Do not use binary packages]:FORMAT_CONTROL:__pip_only_binary_control'
	"--no-clean[Don't clean up build directories]"
	'--require-hashes[Require a hash to check each requirement against, for repeatable installs]'
)
local common_options_wheel=(
	"${common_options_install[@]}"
	'--src[Directory to check out editable projects into]:DIRECTORY:_files -/'
	'--ignore-requires-python[Ignore the Requires-Python information]'
)
local common_options_index=(
	'(--no-index)'{-i,--index-url}'[Base URL of Python Package Index (default https://pypi.python.org/simple)]:URL:_urls'
	'(--no-index)*--extra-index-url[Extra URLs of package indexes to use in addition to --index-url]:URL:_urls'
	'(-i --index-url)--no-index[Ignore package index (only looking at --find-links URLs instead)]'
	{-f,--find-links}'[If a url or path to an html file, then parse for links to archives]:URL:__pip_find_links'
	'--process-dependency-links[Enable the processing of dependency links]'
)
local common_options_user=(
	'--user\[Only output packages installed in user-site\]'
)
local common_options_local=(
	{-l,--local}'[If in a virtualenv that has global access, do not output globally-installed packages]'
)
# }}}
# {{{ helper: installed packages cache policy
__pip_install_packages_cache_policy(){
	# TODO: workout a way that will let users configure via zstyle locations of site-packages
	# the number of seconds since 1970-01-01 the site-packages directories were changed
	local site_packages_user_dir_last_date_modified="$(date -r ~/.local/lib/python3.6/site-packages +%s 2>/dev/null)"
	local site_packages_system_dir_last_date_modified="$(date -r /usr/lib/python3.6/site-packages +%s 2>/dev/null)"
	# the number of seconds since 1970-01-01 the cache file was modified
	local cache_last_date_modified="$(date -r $1 +%s 2>/dev/null)"
	if [[ ! -z "${cache_last_date_modified}" ]] && [[ ! -z "${site_packages_user_dir_last_date_modified}" || ! -z "${site_packages_system_dir_last_date_modified}" ]]; then
		# if the manifest file is newer then the cache:
		if [[ ${site_packages_user_dir_last_date_modified} -ge ${cache_last_date_modified} ]] || [[ ${site_packages_system_dir_last_date_modified} -ge ${cache_last_date_modified} ]]; then
			(( 1 ))
		else
			(( 0 ))
		fi
	else
		(( 1 ))
	fi
}
# }}}
# {{{ helper: installed packages (using cache)
__pip_installed() {
	local update_policy
	zstyle -s ":completion:${curcontext}:" cache-policy update_policy
	if [[ -z "$update_policy" ]]; then
		zstyle ":completion:${curcontext}:" cache-policy __pip_install_packages_cache_policy
	fi
	if _cache_invalid pip_installed_packages; then
		installed_packages=($(pip list --format freeze | sed -n -e 's/\([-a-z_]\+\)==.*/\1/p'))
		_store_cache pip_installed_packages installed_packages
	else
		_retrieve_cache pip_installed_packages
	fi
	_values "installed packages" "${installed_packages[@]}"
}
# }}}
# {{{ helper: available commands
local commands=(
	'install:install packages'
	'download:download packages'
	'uninstall:uninstall packages'
	'freeze:output all currently installed packages (exact versions) to stdout'
	'list:list installed packages'
	'show:show information about installed packages'
	'search:search PyPI'
	'wheel:build individual wheel archives for your requirements and dependencies'
	'hash:compute a hash of a local package archive'
	'help:show available commands'
)
__pip_commands(){
	_describe "pip command" commands
}
# }}}
# {{{ helper: installable packages wrapper
__pip_package(){
	local -a alts
	for arg in "$@"; do
		case $arg in
			"url")
				alts+=(':URL of package:_urls')
				;;
			"file")
				alts+=(':package repo or archive:_files')
				;;
		esac
	done
	_alternative "${alts[@]}"
}
# }}}
# {{{ helper: upgrade strategy
__pip_upgrade_strategy(){
	local strategies=(
		"eager:dependencies are upgraded whether currently installed version satisfies the requirements or not"
		"only-if-needed:are upgraded only when they do not satisfy the requirements of the upgraded package(s)"
	)
	_describe "strategy" strategies
}
# }}}
# {{{ helper: binary control
__pip_no_binary_control(){
	local options=(
		'all:"disable all binary packages"'
		'none:"enable all binary packages"'
	)
	_alternative ": :((${options[@]}))" ": :_message 'packages to install or use:'"
}
__pip_only_binary_control(){
	local options=(
		'all:"enable all binary packages"'
		'none:"disable all binary packages"'
	)
	_alternative ": :((${options[@]}))" ": :{_message 'packages to install or use:'}"
}
# }}}
# {{{ helper: look for html file or url with links to packages or find packages in a directory
__pip_find_links(){
	_alternative ': :_urls' ': :_files -g ".html"' ': :_files -/'
}
# }}}
# {{{ helper: urls or files to install
__pip_install_packages(){
	_alternative ': :_urls' ': :_files'
}
# }}}
# {{{ command install
local command_install_options=(
	"${common_options_help[@]}"
	"${common_options_wheel[@]}"
	"${common_options_index[@]}"
	{-t,--target}'[Install packages into DIRECTORY]:DIRECTORY:_files -/'
	{-d,--download}"[Download packages into <dir> instead of installing them, regardless of what's already installed]:DIRECTORY:_files -/"
	{-U,--upgrade}'[Upgrade all specified packages to the newest available version]'
	'--upgrade-strategy[Determines how dependency upgrading should be handled]:STRATEGY:__pip_upgrade_strategy'
	'--force-reinstall[When upgrading, reinstall all packages even if they are already up-to-date]'
	{-I,--ignore-installed}'[Ignore the installed packages (reinstalling instead)]'
	# TODO: autoload _setup.py to complete options for it
	'*--install-option=[Extra arguments to be supplied to the setup.py install command]:OPTION:_setup.py'
	'--user[Install to the Python user install directory for your platform]'
	"--egg[Install packages as eggs, not 'flat', like pip normally does]"
	'--root[Install everything relative to this alternate root directory]:DIRECTORY:_files -/'
	'--prefix[Installation prefix where lib, bin and other top-level folders are place]:DIRECTORY:_files -/'
	'--compile[Compile py files to pyc]'
	'--no-compile[Do not compile py files to pyc]'
	'--no-use-wheel[DEPRECATED in favour of --no-binary]'
)
_pip_install(){
	_arguments \
		"${command_install_options[@]}" \
		'*:PACKAGE:__pip_install_packages'
}
# }}}
# {{{ command download
local command_download_options=(
	"${common_options_help[@]}"
	"${common_options_install[@]}"
	"${common_options_index[@]}"
	'--src[Directory to check out editable projects into]:DIRECTORY:_files -/'
	{-d,--dest}'[Download packages into DIRECTORY]:DIRECTORY:_files -/'
	'--platform[Only download wheels compatible with PLATFORM]:PLATFORM:'
	'--python-version[Only download wheels compatible with Python interpreter version VERSION]:VERSION:'
	'--implementation[Only download wheels compatible with Python implementation IMPLEMENTATION]:IMPLEMENTATION:'
	'--abi[Only download wheels compatible with Python abi ABI]:ABI:'
)
_pip_download(){
	_arguments \
		"${command_download_options[@]}" \
		'*:PACKAGE:__pip_install_packages'
}
# }}}
# {{{ command uninstall
local command_uninstall_options=(
	"${common_options_help[@]}"
	{\*-r,\*--requirement}'[Uninstall all the packages listed in the given requirements file]:FILE:_files'
	{-y,--yes}"[Don't ask for confirmation of uninstall deletions]"
)
_pip_uninstall(){
	_arguments \
		"${command_uninstall_options[@]}" \
		'*: :__pip_installed'
}
# }}}
# {{{ command freeze
local command_freeze_options=(
	"${common_options_help[@]}"
	"${common_options_local[@]}"
	"${common_options_user[@]}"
	{\*-r,\*--requirement}'[Use the order in the given requirements file and its comments when generating output]:FILE:_files'
	{-f,--find-links}'[URL for finding packages, which will be added to the output]:URL:_urls'
	'--all[Do not skip these packages in the output: pip, setuptools, distribute, wheel]'

)
_pip_freeze(){
	_arguments \
		"${command_freeze_options[@]}"
}
# }}}
# {{{ command list
local command_list_options=(
	"${common_options_help[@]}"
	"${common_options_local[@]}"
	"${common_options_user[@]}"
	"${common_options_pre[@]}"
	{-o,--outdated}'[List outdated packages]'
	{-u,--uptodate}'[List uptodate packages]'
	{-e,--editable}'[List editable projects]'
	'--format[Select the output format among]:FORMAT:(legacy columns freeze json)'
	'--not-required[List packages that are not dependencies of installed packages]'
	"${common_options_index[@]}"
)
_pip_list(){
	_arguments \
		"${command_list_options[@]}" \
		'1: :'
}
# }}}
# {{{ command show
local command_show_options=(
	"${common_options_help[@]}"
	{-f,--files}'[Show the full list of installed files for each package]'
)
_pip_show(){
	_arguments \
		"${command_show_options[@]}" \
		'*: :__pip_installed'
}
# }}}
# {{{ command search
local command_search_options=(
	"${common_options_help[@]}"
	{-i,--index}'[Base URL of Python Package Index (default https://pypi.python.org/pypi)]:URL:_urls'
)
_pip_search(){
	_arguments \
		"${command_search_options[@]}" \
		'*:QUERY:'
}
# }}}
# {{{ command wheel
local command_wheel_options=(
	"${common_options_help[@]}"
	"${common_options_wheel[@]}"
	"${common_options_index[@]}"
	'(--no-wheel-dir)'{-w,--wheel-dir}'[Build wheels into DIRECTORY (default is current working directory)]:DIRECTORY:_files -/'
	'(-w --wheel-dir)--no-wheel-dir[Do not Find and prefer wheel archives when searching indexes and find-links locations]'
)
_pip_wheel(){
	_arguments \
		"${command_wheel_options[@]}" \
		'*:PACKAGE:__pip_install_packages'
}
# }}}
# {{{ command hash
local command_hash_options=(
	"${common_options_help[@]}"
	{-a,--algorithm}'[The hash algorithm to use]:ALGORITHM:(sha256 sha384 sha512)'
)
_pip_hash(){
	_arguments \
		"${command_hash_options[@]}" \
		'1:PACKAGE_ARCHIVE:_files'
}
# }}}
# {{{ command help
local command_help_options=(
	"${common_options_help[@]}"
)
_pip_help(){
	_arguments \
		"${command_help_options[@]}" \
		'1:COMMAND:__pip_commands'
}
# }}}

# The real thing
_arguments \
	"${common_options_help[@]}" \
	'--isolated[run pip in isolated mode, ignores environment variables and user configuration]' \
	{-v,--verbose}'[give more output]' \
	{-V,--version}'[show version number of program and exit]' \
	{-q,--quiet}'[give less output]' \
	'--log[log file location]' \
	'--proxy=[proxy in form user:passwd@proxy.server:port]' \
	'--retries=[max number of retries per connection (default 5 times)]' \
	'--timeout=[socket timeout (default 15s)]' \
	'--exists-action=[default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup]' \
	'--trusted-host=[mark this host as trusted]' \
	'--cert=[path to alternate CA bundle]' \
	'--client-cert=[path to SSL client certificate]' \
	'--cache-dir=[store the cache data in specified directory]' \
	'--no-cache-dir[disable de cache]' \
	'--disable-pip-version-check[do not check periodically for new pip version downloads]' \
	{-E,--environment}'[virtualenv environment to run pip in (deprecated)]' \
	{-s,--enable-site-packages}'[include site-packages in virtualenv (deprecated)]' \
	'1: :__pip_commands' \
	'*::arg:->args'

case "$state" in
	(args)
		curcontext="${curcontext%:*:*}:pip_${words[1]}:"
		# check if a command with a defined completion was typed
		type _pip_${words[1]} &> /dev/null
		if [[ $? != 1 ]]; then
			_pip_${words[1]}
		fi
esac
debug log:

solving cab7fda31 ...
found cab7fda31 in https://inbox.vuxu.org/zsh-workers/20180526150634.15683-21-doron.behar@gmail.com/

applying [1/1] https://inbox.vuxu.org/zsh-workers/20180526150634.15683-21-doron.behar@gmail.com/
diff --git a/src/_pip b/src/_pip
new file mode 100644
index 000000000..cab7fda31

Checking patch src/_pip...
Applied patch src/_pip cleanly.

index at:
100644 cab7fda31fabe0f78d5ebc0e57bf808fd972478a	src/_pip

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).