Lines 1-5
Link Here
|
1 |
#!/usr/bin/python -b |
1 |
#!/usr/bin/python -b |
2 |
# Copyright 2012-2014 Gentoo Foundation |
2 |
# Copyright 2012-2018 Gentoo Foundation |
3 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
|
4 |
|
5 |
doc = """Dump and restore extended attributes. |
5 |
doc = """Dump and restore extended attributes. |
Lines 147-158
def main(argv):
Link Here
|
147 |
actions.add_argument('--dump', |
147 |
actions.add_argument('--dump', |
148 |
action='store_true', |
148 |
action='store_true', |
149 |
help='Dump the values of all extended ' |
149 |
help='Dump the values of all extended ' |
150 |
'attributes associated with null-separated' |
150 |
'attributes associated with paths ' |
151 |
' paths read from stdin.') |
151 |
'passed as arguments or null-separated ' |
|
|
152 |
'paths read from stdin.') |
152 |
actions.add_argument('--restore', |
153 |
actions.add_argument('--restore', |
153 |
action='store_true', |
154 |
action='store_true', |
154 |
help='Restore extended attributes using' |
155 |
help='Restore extended attributes using ' |
155 |
' a dump read from stdin.') |
156 |
'a dump read from stdin.') |
156 |
|
157 |
|
157 |
options = parser.parse_args(argv) |
158 |
options = parser.parse_args(argv) |
158 |
|
159 |
|
Lines 160-169
def main(argv):
Link Here
|
160 |
file_in = sys.stdin.buffer.raw |
161 |
file_in = sys.stdin.buffer.raw |
161 |
else: |
162 |
else: |
162 |
file_in = sys.stdin |
163 |
file_in = sys.stdin |
163 |
if not options.paths: |
|
|
164 |
options.paths += [x for x in file_in.read().split(b'\0') if x] |
165 |
|
164 |
|
166 |
if options.dump: |
165 |
if options.dump: |
|
|
166 |
if options.paths: |
167 |
options.paths = [unicode_encode(x) for x in options.paths] |
168 |
else: |
169 |
options.paths = [x for x in file_in.read().split(b'\0') if x] |
167 |
if sys.hexversion >= 0x3000000: |
170 |
if sys.hexversion >= 0x3000000: |
168 |
file_out = sys.stdout.buffer |
171 |
file_out = sys.stdout.buffer |
169 |
else: |
172 |
else: |
170 |
- |
|
|