Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pmbootstrap
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
postmarketOS
pmbootstrap
Commits
87ea057e
Commit
87ea057e
authored
6 years ago
by
Grant Miller
Browse files
Options
Downloads
Patches
Plain Diff
Improve package completion
parent
abc10aff
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
pmb/helpers/other.py
+0
-8
0 additions, 8 deletions
pmb/helpers/other.py
pmb/parse/arguments.py
+21
-5
21 additions, 5 deletions
pmb/parse/arguments.py
with
21 additions
and
13 deletions
pmb/helpers/other.py
+
0
−
8
View file @
87ea057e
...
...
@@ -24,14 +24,6 @@ import pmb.config
import
pmb.helpers.run
def
getpackagelist
(
aportsdir
):
packages
=
set
()
for
dir
in
os
.
listdir
(
aportsdir
):
for
package
in
os
.
listdir
(
'
aports/
'
+
dir
):
packages
.
add
(
package
)
return
packages
def
folder_size
(
args
,
path
):
"""
Run `du` to calculate the size of a folder (this is less code and
...
...
This diff is collapsed.
Click to expand it.
pmb/parse/arguments.py
+
21
−
5
View file @
87ea057e
...
...
@@ -17,6 +17,14 @@ You should have received a copy of the GNU General Public License
along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
"""
import
argparse
import
glob
import
os
try
:
import
argcomplete
except
ImportError
:
argcomplete
=
False
import
pmb.config
import
pmb.parse.arch
...
...
@@ -219,6 +227,15 @@ def arguments_kconfig(subparser):
parser
.
add_argument
(
"
package
"
)
def
packagecompleter
(
prefix
,
action
,
parser
,
parsed_args
):
args
=
parsed_args
pmb
.
config
.
merge_with_args
(
args
)
packages
=
set
()
for
apkbuild
in
glob
.
glob
(
args
.
aports
+
"
/*/
"
+
prefix
+
"
*/APKBUILD
"
):
packages
.
add
(
os
.
path
.
basename
(
os
.
path
.
dirname
(
apkbuild
)))
return
packages
def
arguments
():
parser
=
argparse
.
ArgumentParser
(
prog
=
"
pmbootstrap
"
)
arch_native
=
pmb
.
parse
.
arch
.
alpine_native
()
...
...
@@ -430,7 +447,9 @@ def arguments():
"
is incompatible with how Alpine
'
s abuild handles it.
"
,
dest
=
"
ignore_depends
"
)
for
action
in
[
checksum
,
build
,
aportgen
]:
action
.
add_argument
(
"
packages
"
,
nargs
=
"
+
"
,
metavar
=
"
PACKAGES
"
,
choices
=
pmb
.
helpers
.
other
.
getpackagelist
(
"
aports
"
))
argument_packages
=
action
.
add_argument
(
"
packages
"
,
nargs
=
"
+
"
)
if
argcomplete
:
argument_packages
.
completer
=
packagecompleter
# Action: kconfig_check / apkbuild_parse
kconfig_check
=
sub
.
add_parser
(
"
kconfig_check
"
,
help
=
"
check, whether all
"
...
...
@@ -459,11 +478,8 @@ def arguments():
help
=
"
force even if the file seems to be
"
"
invalid
"
)
try
:
import
argcomplete
if
argcomplete
:
argcomplete
.
autocomplete
(
parser
)
except
ImportError
:
pass
# Use defaults from the user's config file
args
=
parser
.
parse_args
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment