blob: 357263961df9c9c1d11bf7ca13608bedd344691c [file] [log] [blame]
Brian Silverman6470f442018-08-05 12:08:16 -07001files = {
Brian Silverman4c7235a2021-11-17 19:04:37 -08002 "blt_2.5.3+dfsg-4.1_amd64.deb": "1f4fe70b93976daf7cb728f3fb7561edbb0c78360f053a521ee9075f2ec5c809",
3 "coreutils_8.32-4+b1_amd64.deb": "3558a412ab51eee4b60641327cb145bb91415f127769823b68f9335585b308d4",
4 "fontconfig-config_2.13.1-4.2_all.deb": "48afb6ad7d15e6104a343b789f73697301ad8bff77b69927bc998f5a409d8e90",
5 "fonts-croscore_20201225-1_all.deb": "64904820b729ff40038f85683004e3b94b328d969bc0fbba263c58d635452923",
6 "fonts-dejavu-core_2.37-2_all.deb": "1f67421437b6eb18669d2868e3e02cb88668683d635198142f48aacc5b397118",
7 "fonts-freefont-otf_20120503-10_all.deb": "0b63996c80c6c660424af6d3832818e647960d6f65a51de010bb57dd0762faa7",
8 "fonts-freefont-ttf_20120503-10_all.deb": "4ca1c21ebc479198a3a5879d236c8317d6f7b2f1c403f7890e24c02eead05615",
9 "fonts-liberation2_2.1.3-1_all.deb": "e0805f0085132f5e6dd30f88c0d7260caf1e5450832fe2e3988a20fa9fa2150e",
10 "fonts-liberation_1.07.4-11_all.deb": "efd381517f958b01969343634ffcbdd60056be7779af84c6f53a005090430204",
11 "fonts-lyx_2.3.6-1_all.deb": "c6a1e4105d3c4edc246e4740560c9eda0e5fffec72dd03de256cf10f669fbec8",
12 "fonts-texgyre_20180621-3.1_all.deb": "cb7e9a4b2471cfdd57194c16364f9102f0639816a2662fed4b30d2a158747076",
13 "fonts-urw-base35_20200910-1_all.deb": "f95a139adb7f1b60626e76d4d45d1b35aad1bc2c2597394c291ef5f84b5dcb43",
14 "libattr1_2.4.48-6_amd64.deb": "af3c3562eb2802481a2b9558df1b389f3c6d9b1bf3b4219e000e05131372ebaf",
15 "libbrotli1_1.0.9-2+b2_amd64.deb": "65ca7d8b03e9dac09c5d544a89dd52d1aeb74f6a19583d32e4ff5f0c77624c24",
16 "libbsd0_0.11.3-1_amd64.deb": "284a7b8dcfcad74770f57360721365317448b38ab773db542bf630e94e60c13e",
17 "libdeflate0_1.7-1_amd64.deb": "dadaf0d28360f6eb21ad389b2e0f12f8709c9de539b28de9c11d7ec7043dec95",
18 "libfontconfig1_2.13.1-4.2_amd64.deb": "b92861827627a76e74d6f447a5577d039ef2f95da18af1f29aa98fb96baea4c1",
19 "libfreetype6_2.10.4+dfsg-1_amd64.deb": "e95396fc3cc806b2b95d9a00b4226eb464bc3ef4817c798749a0dd582546e5bc",
20 "libimagequant0_2.12.2-1.1_amd64.deb": "cca1a4d3c24358c75964c720445a1ba50467aa52af7fb82a387f460a4a065096",
21 "libjbig0_2.1-3.1+b2_amd64.deb": "9646d69eefce505407bf0437ea12fb7c2d47a3fd4434720ba46b642b6dcfd80f",
22 "libjpeg62-turbo_2.0.6-4_amd64.deb": "28de780a1605cf501c3a4ebf3e588f5110e814b208548748ab064100c32202ea",
23 "libjs-jquery-ui_1.12.1+dfsg-8+deb11u1_all.deb": "9a2cea1140b526daa97e51f91bea63cb05679c4206d70e926915836d4f72be58",
24 "liblcms2-2_2.12~rc1-2_amd64.deb": "0608ecb6ed258814e390b52b3fb50f2a6d3239b5ecb1086292ae08be00a67b0f",
25 "libmd0_1.0.3-3_amd64.deb": "9e425b3c128b69126d95e61998e1b5ef74e862dd1fc953d91eebcc315aea62ea",
26 "libpng16-16_1.6.37-3_amd64.deb": "7d5336af395d1f658d0e66d74d0e1f4c632028750e7e04314d1a650e0317f3d6",
27 "libtcl8.6_8.6.11+dfsg-1_amd64.deb": "785df3d81010a67ded4a2c216c7b99657c6ab3d1ba7369119894abc851e5bb0c",
28 "libtiff5_4.2.0-1_amd64.deb": "ec12fc6a05a30f8f98878dbb6d9b356d170d5f6239fb68ba6a1dc9eb89ba3194",
29 "libtk8.6_8.6.11-2_amd64.deb": "20d70721a5d539266a8736800378398d088419b986b5313ca811203284690f12",
30 "libwebp6_0.6.1-2.1_amd64.deb": "52bfd0f8d3a1bbd2c25fcd72fab857d0f24aea35874af68e057dde869ae3902c",
31 "libwebpdemux2_0.6.1-2.1_amd64.deb": "bba38f28d461b6b2e94fc51fff34e0d179c2dea3b0c31a77de788f2023be6614",
32 "libwebpmux3_0.6.1-2.1_amd64.deb": "78486e53903cbf422dfe04a33e5481c56c82198a2bfa307f2066e616477395f5",
33 "libx11-6_1.7.2-1_amd64.deb": "086bd667fc07369472a923da015d182bb0c15a72228a5c0e6ddbcbeaab70acd2",
34 "libx11-data_1.7.2-1_all.deb": "049b7eabced516acfdf44a5e81c26d108b16e4987e5d7604ea53eaade74027fb",
35 "libxau6_1.0.9-1_amd64.deb": "679db1c4579ec7c61079adeaae8528adeb2e4bf5465baa6c56233b995d714750",
36 "libxcb1_1.14-3_amd64.deb": "d5e0f047ed766f45eb7473947b70f9e8fddbe45ef22ecfd92ab712c0671a93ac",
James Kuszmaul77253872019-12-28 11:59:57 -080037 "libxdmcp6_1.1.2-3_amd64.deb": "ecb8536f5fb34543b55bb9dc5f5b14c9dbb4150a7bddb3f2287b7cab6e9d25ef",
Brian Silverman4c7235a2021-11-17 19:04:37 -080038 "libxext6_1.3.3-1.1_amd64.deb": "dc1ff8a2b60c7dd3c8917ffb9aa65ee6cda52648d9150608683c47319d1c0c8c",
Austin Schuh085eab92020-11-26 13:54:51 -080039 "libxft2_2.3.2-2_amd64.deb": "cd71384b4d511cba69bcee29af326943c7ca12450765f44c40d246608c779aad",
James Kuszmaul77253872019-12-28 11:59:57 -080040 "libxrender1_0.9.10-1_amd64.deb": "3ea17d07b5aa89012130e2acd92f0fc0ea67314e2f5eab6e33930ef688f48294",
Austin Schuh085eab92020-11-26 13:54:51 -080041 "libxss1_1.2.3-1_amd64.deb": "85cce16368f08a878fa892fbc54520fc654d00769cde6d300b8b802734a993c0",
Brian Silverman4c7235a2021-11-17 19:04:37 -080042 "python-matplotlib-data_3.3.4-1_all.deb": "3ae74d712766f261e41502a712ec8b471f7514b7fc4ae03fb6df539a553b61ff",
43 "python3-cycler_0.10.0-3_all.deb": "87022b0aaf76b345ed80a6737326592a6009035a0eb694f475030ad325e91262",
44 "python3-dateutil_2.8.1-6_all.deb": "59d2e32149471adee915d6b721726612c873a83f262a041899573a1867e9e450",
45 "python3-kiwisolver_1.3.1-1+b1_amd64.deb": "ace5f22edfc057f252a57da7c04145ae298dddc658e3e72dbe7bddd39e03838a",
46 "python3-matplotlib_3.3.4-1_amd64.deb": "e411a5de1fb43c3076697b48ec7eb36d4c98e6359d6717b34adfdd40b49fb9d5",
47 "python3-pil.imagetk_8.1.2+dfsg-0.3_amd64.deb": "b0e98d9c7ebdee941b0a24f40c7b29b4cb4c8759e04c478da1d0380ebf956c1e",
48 "python3-pil_8.1.2+dfsg-0.3_amd64.deb": "a0e44fe855f0b4f7a175fe4dad7db27a18adc8a0119e930010bc95641c66237a",
49 "python3-pyparsing_2.4.7-1_all.deb": "bec23dc18bb37357f34e77e3f9590224b2d0f3bb4d9bb099600fa2d547800aa3",
50 "python3-six_1.16.0-2_all.deb": "acd4271ba56e42298b9fab0fcdad8f319970b50d1026f8469eed968a20f28761",
51 "python3-tk_3.9.2-1_amd64.deb": "272db7708d60675b6aaea98aef64131e2bc9ec443ad677ef247d341632d9ef07",
52 "sensible-utils_0.0.14_all.deb": "b9a447dc4ec8714196b037e20a2209e62cd669f5450222952f259bda4416b71f",
53 "tk8.6-blt2.5_2.5.3+dfsg-4.1_amd64.deb": "f12f8dd7ed62386d4a798ee84df7fd976b9ba4d9a930ba5b5d4bf48bd16437ca",
54 "ttf-bitstream-vera_1.10-8.1_all.deb": "ba622edf73744b2951bbd20bfc113a1a875a9b0c6fed1ac9e9c7f4b54dd8a048",
55 "ucf_3.0043_all.deb": "ebef6bcd777b5c0cc2699926f2159db08433aed07c50cb321fd828b28c5e8d53",
Brian Silverman6470f442018-08-05 12:08:16 -070056}
James Kuszmaul910f92b2020-01-01 15:30:38 -080057
58def build_matplotlib(version, tkinter_py_version = None, copy_shared_files = True):
Brian Silvermandc7d8052020-01-31 17:44:30 -080059 """Creates a py_library rule for matplotlib for the given python version.
James Kuszmaul910f92b2020-01-01 15:30:38 -080060
Brian Silvermandc7d8052020-01-31 17:44:30 -080061 See debian/matplotlib.BUILD for the usage.
James Kuszmaul910f92b2020-01-01 15:30:38 -080062
Brian Silvermandc7d8052020-01-31 17:44:30 -080063 All the rules generated by this will be suffixed by version. Only one
64 instance of this macro should set copy_shared_files, which generate the
65 files that are shared between python versions.
James Kuszmaul910f92b2020-01-01 15:30:38 -080066
Brian Silvermandc7d8052020-01-31 17:44:30 -080067 tkinter_py_version is used because for the Python3 instance, some files
68 are in folders named python3 and some are in folders named python3.5...
James Kuszmaul910f92b2020-01-01 15:30:38 -080069
Brian Silvermandc7d8052020-01-31 17:44:30 -080070 version numbers should both be strings.
71 """
72 if tkinter_py_version == None:
73 tkinter_py_version = version
James Kuszmaul910f92b2020-01-01 15:30:38 -080074
James Kuszmaul910f92b2020-01-01 15:30:38 -080075 native.genrule(
Brian Silvermandc7d8052020-01-31 17:44:30 -080076 name = "patch_init" + version,
77 srcs = [
78 "usr/lib/python" + version + "/dist-packages/matplotlib/__init__.py",
79 "@//debian:matplotlib_patches",
80 ],
81 outs = [version + "/matplotlib/__init__.py"],
82 cmd = " && ".join([
83 "cp $(location usr/lib/python" + version + "/dist-packages/matplotlib/__init__.py) $@",
84 "readonly PATCH=\"$$(readlink -f $(location @patch))\"",
85 "readonly FILE=\"$$(readlink -f $(location @//debian:matplotlib_patches))\"",
86 "(cd $(@D) && \"$${PATCH}\" -p1 < \"$${FILE}\") > /dev/null",
James Kuszmaul910f92b2020-01-01 15:30:38 -080087 ]),
Brian Silvermandc7d8052020-01-31 17:44:30 -080088 tools = [
89 "@patch",
90 ],
James Kuszmaul910f92b2020-01-01 15:30:38 -080091 )
92
Brian Silvermandc7d8052020-01-31 17:44:30 -080093 _src_files = native.glob(
94 include = ["usr/lib/python" + version + "/dist-packages/**/*.py"],
95 exclude = [
96 "usr/lib/python" + version + "/dist-packages/matplotlib/__init__.py",
97 ],
98 )
99
100 _data_files = native.glob([
101 "usr/share/matplotlib/mpl-data/**",
102 "usr/share/tcltk/**",
103 ])
104
105 _src_copied = ["/".join([version] + f.split("/")[4:]) for f in _src_files]
106
107 _builtin_so_files = native.glob([
108 "usr/lib/python" + version + "/dist-packages/**/*x86_64-linux-gnu.so",
109 "usr/lib/python" + tkinter_py_version + "/lib-dynload/*.so",
110 ])
111
112 _system_so_files = native.glob([
113 "usr/lib/**/*.so*",
114 "lib/x86_64-linux-gnu/**/*.so*",
115 ])
116
117 _builtin_so_copied = ["/".join([version] + f.split("/")[4:]) for f in _builtin_so_files]
118
119 rpath_prefix = "rpathed" + version + "/"
120
121 _system_so_copied = [rpath_prefix + f for f in _system_so_files]
122
123 _builtin_rpaths = [":".join([
124 "\\$$ORIGIN/%s" % rel,
125 "\\$$ORIGIN/%s/%s/usr/lib/x86_64-linux-gnu" % (rel, rpath_prefix),
126 "\\$$ORIGIN/%s/%s/usr/lib" % (rel, rpath_prefix),
127 "\\$$ORIGIN/%s/%s/lib/x86_64-linux-gnu" % (rel, rpath_prefix),
128 ]) for rel in ["/".join([".." for _ in so.split("/")[1:]]) for so in _builtin_so_copied]]
129
130 _system_rpaths = [":".join([
131 "\\$$ORIGIN/%s/%s/usr/lib/x86_64-linux-gnu" % (rel, rpath_prefix),
132 "\\$$ORIGIN/%s/%s/lib/x86_64-linux-gnu" % (rel, rpath_prefix),
133 ]) for rel in ["/".join([".." for _ in so.split("/")[1:]]) for so in _system_so_copied]]
134
135 native.genrule(
136 name = "run_patchelf_builtin" + version,
137 srcs = _builtin_so_files,
138 outs = _builtin_so_copied,
139 cmd = "\n".join(
140 [
141 "cp $(location %s) $(location %s)" % (src, dest)
142 for src, dest in zip(_builtin_so_files, _builtin_so_copied)
143 ] +
144 ["$(location @patchelf) --set-rpath %s $(location %s)" % (rpath, so) for rpath, so in zip(_builtin_rpaths, _builtin_so_copied)],
145 ),
146 tools = [
147 "@patchelf",
148 ],
149 )
150
151 native.genrule(
152 name = "run_patchelf_system" + version,
153 srcs = _system_so_files,
154 outs = _system_so_copied,
155 cmd = "\n".join(
156 [
157 "cp $(location %s) $(location %s)" % (src, dest)
158 for src, dest in zip(_system_so_files, _system_so_copied)
159 ] +
160 ["$(location @patchelf) --set-rpath %s $(location %s)" % (rpath, so) for rpath, so in zip(_system_rpaths, _system_so_copied)],
161 ),
162 tools = [
163 "@patchelf",
164 ],
165 )
166
167 native.genrule(
168 name = "copy_files" + version,
169 srcs = _src_files,
170 outs = _src_copied,
171 cmd = " && ".join(["cp $(location %s) $(location %s)" % (src, dest) for src, dest in zip(
172 _src_files,
173 _src_copied,
174 )]),
175 )
176
177 if copy_shared_files:
178 native.genrule(
179 name = "create_rc" + version,
Brian Silverman4c7235a2021-11-17 19:04:37 -0800180 srcs = ["etc/matplotlibrc"],
Brian Silvermandc7d8052020-01-31 17:44:30 -0800181 outs = ["usr/share/matplotlib/mpl-data/matplotlibrc"],
Brian Silverman4c7235a2021-11-17 19:04:37 -0800182 cmd = "cat $< > $@",
Brian Silvermandc7d8052020-01-31 17:44:30 -0800183 )
184
185 native.py_library(
186 name = "matplotlib" + version,
187 srcs = _src_copied + [
188 version + "/matplotlib/__init__.py",
Austin Schuhcd1f7252021-09-24 21:11:43 -0700189 ] + native.glob(
190 include = ["usr/lib/python" + tkinter_py_version + "/**/*.py"],
191 ),
Brian Silvermandc7d8052020-01-31 17:44:30 -0800192 data = _data_files + _builtin_so_copied + _system_so_copied + [
Austin Schuhcd1f7252021-09-24 21:11:43 -0700193 ] + native.glob(["etc/**", "usr/share/fonts/**"]),
194 imports = [
195 "rpathed3/usr/lib/python" + version + "/dist-packages",
Brian Silverman4c7235a2021-11-17 19:04:37 -0800196 "rpathed3/usr/lib/python" + version + ".9/lib-dynload",
Austin Schuhcd1f7252021-09-24 21:11:43 -0700197 version,
198 ".",
199 "usr/lib/python" + tkinter_py_version,
200 ],
Philipp Schraderdada1072020-11-24 11:34:46 -0800201 target_compatible_with = ["@platforms//cpu:x86_64"],
Brian Silvermandc7d8052020-01-31 17:44:30 -0800202 visibility = ["//visibility:public"],
Ravago Jonesd126d762022-02-21 23:18:15 -0800203 deps = [
204 "@python_repo//:numpy",
205 ],
Brian Silvermandc7d8052020-01-31 17:44:30 -0800206 )