Skip to content

Commit 89b9c16

Browse files
pilleyefacebook-github-bot
authored andcommitted
Back out "get rid of bundled init_cinderx"
Summary: Original commit changeset: fe566e19e32c Original Phabricator Diff: D70263853 Multisect failure: T216700091 Hand to manually backout because of bouncy castle failure: https://www.internalfb.com/sandcastle/group/nonce/6964058095711753/ Reviewed By: alexmalyshev Differential Revision: D70920235 fbshipit-source-id: 11c4d5dec7c367f2b696b814bc1c2d8f2554f6d8
1 parent b573bcc commit 89b9c16

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Lib/init_cinderx.py

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# ONLY USED FOR CINDERX DEVELOPMENT
2+
# This file is deliberately not included in the set of deep-frozen bootstrap
3+
# libraries so it can easily be excluded from the distribution to avoid
4+
# attempting to initialize CinderX. This is desirable because this code imports
5+
# importlib.util and some tests are surprised when they find this unexpectedly
6+
# loaded as part of bootstrap.
7+
8+
import importlib.util
9+
10+
# `cinderx` is the Python module in fbcode/cinderx/PythonLib which wraps the
11+
# `_cinderx` C++ extension in fbcode/cinderx/_cinderx.cpp. Both need to be
12+
# available to load CinderX.
13+
if not (
14+
importlib.util.find_spec("cinderx") is None
15+
or importlib.util.find_spec("_cinderx") is None
16+
):
17+
try:
18+
import cinderx
19+
20+
cinderx.init()
21+
except Exception as e:
22+
raise RuntimeError("Failed to initialize CinderX module") from e

0 commit comments

Comments
 (0)