##// END OF EJS Templates
fixpax: use absolute_import and print_function
Pulkit Goyal -
r28354:00f31778 default
parent child Browse files
Show More
@@ -1,61 +1,64 b''
1 1 #!/usr/bin/env python
2 2 # fixpax - fix ownership in bdist_mpkg output
3 3 #
4 4 # Copyright 2015 Matt Mackall <mpm@selenic.com>
5 5 #
6 6 # This software may be used and distributed according to the terms of the
7 7 # MIT license (http://opensource.org/licenses/MIT)
8 8
9 9 """Set file ownership to 0 in an Archive.pax.gz.
10 10 Suitable for fixing files bdist_mpkg output:
11 11 *.mpkg/Contents/Packages/*.pkg/Contents/Archive.pax.gz
12 12 """
13 13
14 import sys, os, gzip
14 from __future__ import absolute_import, print_function
15 import gzip
16 import os
17 import sys
15 18
16 19 def fixpax(iname, oname):
17 20 i = gzip.GzipFile(iname)
18 21 o = gzip.GzipFile(oname, "w")
19 22
20 23 while True:
21 24 magic = i.read(6)
22 25 dev = i.read(6)
23 26 ino = i.read(6)
24 27 mode = i.read(6)
25 28 i.read(6) # uid
26 29 i.read(6) # gid
27 30 nlink = i.read(6)
28 31 rdev = i.read(6)
29 32 mtime = i.read(11)
30 33 namesize = i.read(6)
31 34 filesize = i.read(11)
32 35 name = i.read(int(namesize, 8))
33 36 data = i.read(int(filesize, 8))
34 37
35 38 o.write(magic)
36 39 o.write(dev)
37 40 o.write(ino)
38 41 o.write(mode)
39 42 o.write("000000")
40 43 o.write("000000")
41 44 o.write(nlink)
42 45 o.write(rdev)
43 46 o.write(mtime)
44 47 o.write(namesize)
45 48 o.write(filesize)
46 49 o.write(name)
47 50 o.write(data)
48 51
49 52 if name.startswith("TRAILER!!!"):
50 53 o.write(i.read())
51 54 break
52 55
53 56 o.close()
54 57 i.close()
55 58
56 59 if __name__ == '__main__':
57 60 for iname in sys.argv[1:]:
58 print 'fixing file ownership in %s' % iname
61 print('fixing file ownership in %s' % iname)
59 62 oname = sys.argv[1] + '.tmp'
60 63 fixpax(iname, oname)
61 64 os.rename(oname, iname)
@@ -1,162 +1,160 b''
1 1 #require test-repo
2 2
3 3 $ cd "$TESTDIR"/..
4 4
5 5 $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
6 6 contrib/check-code.py not using absolute_import
7 7 contrib/check-code.py requires print_function
8 8 contrib/debugshell.py not using absolute_import
9 contrib/fixpax.py not using absolute_import
10 contrib/fixpax.py requires print_function
11 9 contrib/hgclient.py not using absolute_import
12 10 contrib/hgclient.py requires print_function
13 11 contrib/hgfixes/fix_bytes.py not using absolute_import
14 12 contrib/hgfixes/fix_bytesmod.py not using absolute_import
15 13 contrib/hgfixes/fix_leftover_imports.py not using absolute_import
16 14 contrib/import-checker.py not using absolute_import
17 15 contrib/import-checker.py requires print_function
18 16 contrib/memory.py not using absolute_import
19 17 contrib/perf.py not using absolute_import
20 18 contrib/python-hook-examples.py not using absolute_import
21 19 contrib/revsetbenchmarks.py not using absolute_import
22 20 contrib/revsetbenchmarks.py requires print_function
23 21 contrib/showstack.py not using absolute_import
24 22 contrib/synthrepo.py not using absolute_import
25 23 contrib/win32/hgwebdir_wsgi.py not using absolute_import
26 24 doc/check-seclevel.py not using absolute_import
27 25 doc/gendoc.py not using absolute_import
28 26 doc/hgmanpage.py not using absolute_import
29 27 hgext/__init__.py not using absolute_import
30 28 hgext/color.py not using absolute_import
31 29 hgext/convert/__init__.py not using absolute_import
32 30 hgext/convert/bzr.py not using absolute_import
33 31 hgext/convert/common.py not using absolute_import
34 32 hgext/convert/convcmd.py not using absolute_import
35 33 hgext/convert/cvs.py not using absolute_import
36 34 hgext/convert/cvsps.py not using absolute_import
37 35 hgext/convert/darcs.py not using absolute_import
38 36 hgext/convert/filemap.py not using absolute_import
39 37 hgext/convert/git.py not using absolute_import
40 38 hgext/convert/gnuarch.py not using absolute_import
41 39 hgext/convert/hg.py not using absolute_import
42 40 hgext/convert/monotone.py not using absolute_import
43 41 hgext/convert/p4.py not using absolute_import
44 42 hgext/convert/subversion.py not using absolute_import
45 43 hgext/convert/transport.py not using absolute_import
46 44 hgext/eol.py not using absolute_import
47 45 hgext/extdiff.py not using absolute_import
48 46 hgext/factotum.py not using absolute_import
49 47 hgext/fetch.py not using absolute_import
50 48 hgext/gpg.py not using absolute_import
51 49 hgext/graphlog.py not using absolute_import
52 50 hgext/hgcia.py not using absolute_import
53 51 hgext/hgk.py not using absolute_import
54 52 hgext/highlight/__init__.py not using absolute_import
55 53 hgext/highlight/highlight.py not using absolute_import
56 54 hgext/histedit.py not using absolute_import
57 55 hgext/largefiles/__init__.py not using absolute_import
58 56 hgext/largefiles/basestore.py not using absolute_import
59 57 hgext/largefiles/lfcommands.py not using absolute_import
60 58 hgext/largefiles/lfutil.py not using absolute_import
61 59 hgext/largefiles/localstore.py not using absolute_import
62 60 hgext/largefiles/overrides.py not using absolute_import
63 61 hgext/largefiles/proto.py not using absolute_import
64 62 hgext/largefiles/remotestore.py not using absolute_import
65 63 hgext/largefiles/reposetup.py not using absolute_import
66 64 hgext/largefiles/uisetup.py not using absolute_import
67 65 hgext/largefiles/wirestore.py not using absolute_import
68 66 hgext/mq.py not using absolute_import
69 67 hgext/notify.py not using absolute_import
70 68 hgext/patchbomb.py not using absolute_import
71 69 hgext/purge.py not using absolute_import
72 70 hgext/rebase.py not using absolute_import
73 71 hgext/record.py not using absolute_import
74 72 hgext/relink.py not using absolute_import
75 73 hgext/schemes.py not using absolute_import
76 74 hgext/share.py not using absolute_import
77 75 hgext/shelve.py not using absolute_import
78 76 hgext/strip.py not using absolute_import
79 77 hgext/transplant.py not using absolute_import
80 78 hgext/win32mbcs.py not using absolute_import
81 79 hgext/win32text.py not using absolute_import
82 80 i18n/check-translation.py not using absolute_import
83 81 i18n/polib.py not using absolute_import
84 82 setup.py not using absolute_import
85 83 tests/filterpyflakes.py requires print_function
86 84 tests/generate-working-copy-states.py requires print_function
87 85 tests/get-with-headers.py requires print_function
88 86 tests/heredoctest.py requires print_function
89 87 tests/hypothesishelpers.py not using absolute_import
90 88 tests/hypothesishelpers.py requires print_function
91 89 tests/killdaemons.py not using absolute_import
92 90 tests/md5sum.py not using absolute_import
93 91 tests/mockblackbox.py not using absolute_import
94 92 tests/printenv.py not using absolute_import
95 93 tests/readlink.py not using absolute_import
96 94 tests/readlink.py requires print_function
97 95 tests/revlog-formatv0.py not using absolute_import
98 96 tests/run-tests.py not using absolute_import
99 97 tests/seq.py not using absolute_import
100 98 tests/seq.py requires print_function
101 99 tests/silenttestrunner.py not using absolute_import
102 100 tests/silenttestrunner.py requires print_function
103 101 tests/sitecustomize.py not using absolute_import
104 102 tests/svn-safe-append.py not using absolute_import
105 103 tests/svnxml.py not using absolute_import
106 104 tests/test-ancestor.py requires print_function
107 105 tests/test-atomictempfile.py not using absolute_import
108 106 tests/test-batching.py not using absolute_import
109 107 tests/test-batching.py requires print_function
110 108 tests/test-bdiff.py not using absolute_import
111 109 tests/test-bdiff.py requires print_function
112 110 tests/test-context.py not using absolute_import
113 111 tests/test-context.py requires print_function
114 112 tests/test-demandimport.py not using absolute_import
115 113 tests/test-demandimport.py requires print_function
116 114 tests/test-dispatch.py not using absolute_import
117 115 tests/test-dispatch.py requires print_function
118 116 tests/test-doctest.py not using absolute_import
119 117 tests/test-duplicateoptions.py not using absolute_import
120 118 tests/test-duplicateoptions.py requires print_function
121 119 tests/test-filecache.py not using absolute_import
122 120 tests/test-filecache.py requires print_function
123 121 tests/test-filelog.py not using absolute_import
124 122 tests/test-filelog.py requires print_function
125 123 tests/test-hg-parseurl.py not using absolute_import
126 124 tests/test-hg-parseurl.py requires print_function
127 125 tests/test-hgweb-auth.py not using absolute_import
128 126 tests/test-hgweb-auth.py requires print_function
129 127 tests/test-hgwebdir-paths.py not using absolute_import
130 128 tests/test-hybridencode.py not using absolute_import
131 129 tests/test-hybridencode.py requires print_function
132 130 tests/test-lrucachedict.py not using absolute_import
133 131 tests/test-lrucachedict.py requires print_function
134 132 tests/test-manifest.py not using absolute_import
135 133 tests/test-minirst.py not using absolute_import
136 134 tests/test-minirst.py requires print_function
137 135 tests/test-parseindex2.py not using absolute_import
138 136 tests/test-parseindex2.py requires print_function
139 137 tests/test-pathencode.py not using absolute_import
140 138 tests/test-pathencode.py requires print_function
141 139 tests/test-propertycache.py not using absolute_import
142 140 tests/test-propertycache.py requires print_function
143 141 tests/test-revlog-ancestry.py not using absolute_import
144 142 tests/test-revlog-ancestry.py requires print_function
145 143 tests/test-run-tests.py not using absolute_import
146 144 tests/test-simplemerge.py not using absolute_import
147 145 tests/test-status-inprocess.py not using absolute_import
148 146 tests/test-status-inprocess.py requires print_function
149 147 tests/test-symlink-os-yes-fs-no.py not using absolute_import
150 148 tests/test-trusted.py not using absolute_import
151 149 tests/test-trusted.py requires print_function
152 150 tests/test-ui-color.py not using absolute_import
153 151 tests/test-ui-color.py requires print_function
154 152 tests/test-ui-config.py not using absolute_import
155 153 tests/test-ui-config.py requires print_function
156 154 tests/test-ui-verbosity.py not using absolute_import
157 155 tests/test-ui-verbosity.py requires print_function
158 156 tests/test-url.py not using absolute_import
159 157 tests/test-url.py requires print_function
160 158 tests/test-walkrepo.py requires print_function
161 159 tests/test-wireproto.py requires print_function
162 160 tests/tinyproxy.py requires print_function
General Comments 0
You need to be logged in to leave comments. Login now