]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Remove `import` use from TARGETS
authorAndres Suarez <zertosh@gmail.com>
Thu, 30 Nov 2017 23:22:41 +0000 (15:22 -0800)
committerYi Wu <yiwu@fb.com>
Fri, 1 Dec 2017 00:05:36 +0000 (16:05 -0800)
Summary:
We're moving away from `import`. The equivalent internal construct that
gets the directory from `fbcode/` is `package_name()`. This is a
Skylark friendly wrapper around [`get_base_path`].

The additional whitespace change is from running `python ./buckifier/buckify_rocksdb.py`.

[`get_base_path`]: https://buckbuild.com/function/get_base_path.html
Closes https://github.com/facebook/rocksdb/pull/3210

Reviewed By: yiwu-arbug

Differential Revision: D6451242

Pulled By: zertosh

fbshipit-source-id: 445757261de0ec89d5d332c1ba9af097086326dc

TARGETS
buckifier/targets_cfg.py

diff --git a/TARGETS b/TARGETS
index 25b5c073174e81577deb7453bfdf26ff3fd08f68..9d3b2bce76b89d544b8388827b0529f4b29d20cd 100644 (file)
--- a/TARGETS
+++ b/TARGETS
@@ -1,8 +1,4 @@
-import os
-
-TARGETS_PATH = os.path.dirname(__file__)
-
-REPO_PATH = TARGETS_PATH[(TARGETS_PATH.find('fbcode/') + len('fbcode/')):] + "/"
+REPO_PATH = package_name() + "/"
 
 BUCK_BINS = "buck-out/gen/" + REPO_PATH
 
@@ -1033,7 +1029,7 @@ if not is_opt_mode:
         test_cc = test_cfg[1]
         ttype = "gtest" if test_cfg[2] == "parallel" else "simple"
         test_bin = test_name + "_bin"
-    
+
         cpp_binary (
           name = test_bin,
           srcs = [test_cc],
@@ -1043,7 +1039,7 @@ if not is_opt_mode:
           compiler_flags = rocksdb_compiler_flags,
           external_deps = rocksdb_external_deps,
         )
-    
+
         custom_unittest(
           name = test_name,
           type = ttype,
index bda90e36d7b7864e6a37f2b63f9da63fb15063c8..7aee5bdc9c03d1bfec30ed3d81b49e0ba00bc315 100644 (file)
@@ -2,11 +2,7 @@ from __future__ import absolute_import
 from __future__ import division
 from __future__ import print_function
 from __future__ import unicode_literals
-rocksdb_target_header = """import os
-
-TARGETS_PATH = os.path.dirname(__file__)
-
-REPO_PATH = TARGETS_PATH[(TARGETS_PATH.find('fbcode/') + len('fbcode/')):] + "/"
+rocksdb_target_header = """REPO_PATH = package_name() + "/"
 
 BUCK_BINS = "buck-out/gen/" + REPO_PATH