Show More
@@ -0,0 +1,15 | |||
|
1 | [package] | |
|
2 | name = "hg-pyo3" | |
|
3 | version = "0.1.0" | |
|
4 | edition = "2021" | |
|
5 | ||
|
6 | [lib] | |
|
7 | name='rusthgpyo3' | |
|
8 | crate-type = ["cdylib"] | |
|
9 | ||
|
10 | [dependencies] | |
|
11 | pyo3 = { version = "0.20.0", features = ["extension-module"] } | |
|
12 | hg-core = { path = "../hg-core"} | |
|
13 | stable_deref_trait = "1.2.0" | |
|
14 | log = "0.4.17" | |
|
15 | env_logger = "0.9.3" No newline at end of file |
@@ -0,0 +1,6 | |||
|
1 | use pyo3::prelude::*; | |
|
2 | ||
|
3 | #[pymodule] | |
|
4 | fn pyo3_rustext(_py: Python<'_>, _m: &PyModule) -> PyResult<()> { | |
|
5 | Ok(()) | |
|
6 | } |
@@ -132,7 +132,9 def _isrustpermissive() -> bool: | |||
|
132 | 132 | return policy.endswith(b'-allow') |
|
133 | 133 | |
|
134 | 134 | |
|
135 | def importrust(modname: str, member: "Optional[str]" = None, default=None): | |
|
135 | def importrust( | |
|
136 | modname: str, member: "Optional[str]" = None, default=None, pyo3=False | |
|
137 | ): | |
|
136 | 138 | """Import Rust module according to policy and availability. |
|
137 | 139 | |
|
138 | 140 | If policy isn't a Rust one, this returns `default`. |
@@ -143,8 +145,10 def importrust(modname: str, member: "Op | |||
|
143 | 145 | if not policy.startswith(b'rust'): |
|
144 | 146 | return default |
|
145 | 147 | |
|
148 | dlib_name = "pyo3-rustext" if pyo3 else "rustext" | |
|
149 | ||
|
146 | 150 | try: |
|
147 |
mod = _importfrom( |
|
|
151 | mod = _importfrom(dlib_name, modname) | |
|
148 | 152 | except ImportError: |
|
149 | 153 | if _isrustpermissive(): |
|
150 | 154 | return default |
@@ -95,6 +95,17 dependencies = [ | |||
|
95 | 95 | ] |
|
96 | 96 | |
|
97 | 97 | [[package]] |
|
98 | name = "atty" | |
|
99 | version = "0.2.14" | |
|
100 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
101 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" | |
|
102 | dependencies = [ | |
|
103 | "hermit-abi", | |
|
104 | "libc", | |
|
105 | "winapi", | |
|
106 | ] | |
|
107 | ||
|
108 | [[package]] | |
|
98 | 109 | name = "autocfg" |
|
99 | 110 | version = "1.4.0" |
|
100 | 111 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -259,7 +270,7 version = "4.5.18" | |||
|
259 | 270 | source = "registry+https://github.com/rust-lang/crates.io-index" |
|
260 | 271 | checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" |
|
261 | 272 | dependencies = [ |
|
262 | "heck", | |
|
273 | "heck 0.5.0", | |
|
263 | 274 | "proc-macro2", |
|
264 | 275 | "quote", |
|
265 | 276 | "syn 2.0.89", |
@@ -475,6 +486,19 dependencies = [ | |||
|
475 | 486 | |
|
476 | 487 | [[package]] |
|
477 | 488 | name = "env_logger" |
|
489 | version = "0.9.3" | |
|
490 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
491 | checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" | |
|
492 | dependencies = [ | |
|
493 | "atty", | |
|
494 | "humantime", | |
|
495 | "log", | |
|
496 | "regex", | |
|
497 | "termcolor", | |
|
498 | ] | |
|
499 | ||
|
500 | [[package]] | |
|
501 | name = "env_logger" | |
|
478 | 502 | version = "0.11.5" |
|
479 | 503 | source = "registry+https://github.com/rust-lang/crates.io-index" |
|
480 | 504 | checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d" |
@@ -601,11 +625,26 dependencies = [ | |||
|
601 | 625 | |
|
602 | 626 | [[package]] |
|
603 | 627 | name = "heck" |
|
628 | version = "0.4.1" | |
|
629 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
630 | checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" | |
|
631 | ||
|
632 | [[package]] | |
|
633 | name = "heck" | |
|
604 | 634 | version = "0.5.0" |
|
605 | 635 | source = "registry+https://github.com/rust-lang/crates.io-index" |
|
606 | 636 | checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" |
|
607 | 637 | |
|
608 | 638 | [[package]] |
|
639 | name = "hermit-abi" | |
|
640 | version = "0.1.19" | |
|
641 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
642 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" | |
|
643 | dependencies = [ | |
|
644 | "libc", | |
|
645 | ] | |
|
646 | ||
|
647 | [[package]] | |
|
609 | 648 | name = "hex" |
|
610 | 649 | version = "0.4.3" |
|
611 | 650 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -665,7 +704,7 version = "0.1.0" | |||
|
665 | 704 | dependencies = [ |
|
666 | 705 | "cpython", |
|
667 | 706 | "crossbeam-channel", |
|
668 | "env_logger", | |
|
707 | "env_logger 0.11.5", | |
|
669 | 708 | "hg-core", |
|
670 | 709 | "libc", |
|
671 | 710 | "log", |
@@ -676,6 +715,17 dependencies = [ | |||
|
676 | 715 | ] |
|
677 | 716 | |
|
678 | 717 | [[package]] |
|
718 | name = "hg-pyo3" | |
|
719 | version = "0.1.0" | |
|
720 | dependencies = [ | |
|
721 | "env_logger 0.9.3", | |
|
722 | "hg-core", | |
|
723 | "log", | |
|
724 | "pyo3", | |
|
725 | "stable_deref_trait", | |
|
726 | ] | |
|
727 | ||
|
728 | [[package]] | |
|
679 | 729 | name = "home" |
|
680 | 730 | version = "0.5.9" |
|
681 | 731 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -751,6 +801,12 dependencies = [ | |||
|
751 | 801 | ] |
|
752 | 802 | |
|
753 | 803 | [[package]] |
|
804 | name = "indoc" | |
|
805 | version = "2.0.5" | |
|
806 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
807 | checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5" | |
|
808 | ||
|
809 | [[package]] | |
|
754 | 810 | name = "is_terminal_polyfill" |
|
755 | 811 | version = "1.70.1" |
|
756 | 812 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -830,6 +886,16 source = "registry+https://github.com/ru | |||
|
830 | 886 | checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" |
|
831 | 887 | |
|
832 | 888 | [[package]] |
|
889 | name = "lock_api" | |
|
890 | version = "0.4.12" | |
|
891 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
892 | checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" | |
|
893 | dependencies = [ | |
|
894 | "autocfg", | |
|
895 | "scopeguard", | |
|
896 | ] | |
|
897 | ||
|
898 | [[package]] | |
|
833 | 899 | name = "log" |
|
834 | 900 | version = "0.4.22" |
|
835 | 901 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -874,6 +940,15 dependencies = [ | |||
|
874 | 940 | ] |
|
875 | 941 | |
|
876 | 942 | [[package]] |
|
943 | name = "memoffset" | |
|
944 | version = "0.9.1" | |
|
945 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
946 | checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" | |
|
947 | dependencies = [ | |
|
948 | "autocfg", | |
|
949 | ] | |
|
950 | ||
|
951 | [[package]] | |
|
877 | 952 | name = "miniz_oxide" |
|
878 | 953 | version = "0.8.0" |
|
879 | 954 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -947,6 +1022,29 dependencies = [ | |||
|
947 | 1022 | ] |
|
948 | 1023 | |
|
949 | 1024 | [[package]] |
|
1025 | name = "parking_lot" | |
|
1026 | version = "0.12.3" | |
|
1027 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1028 | checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" | |
|
1029 | dependencies = [ | |
|
1030 | "lock_api", | |
|
1031 | "parking_lot_core", | |
|
1032 | ] | |
|
1033 | ||
|
1034 | [[package]] | |
|
1035 | name = "parking_lot_core" | |
|
1036 | version = "0.9.10" | |
|
1037 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1038 | checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" | |
|
1039 | dependencies = [ | |
|
1040 | "cfg-if", | |
|
1041 | "libc", | |
|
1042 | "redox_syscall", | |
|
1043 | "smallvec", | |
|
1044 | "windows-targets 0.52.6", | |
|
1045 | ] | |
|
1046 | ||
|
1047 | [[package]] | |
|
950 | 1048 | name = "paste" |
|
951 | 1049 | version = "1.0.15" |
|
952 | 1050 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -993,6 +1091,69 dependencies = [ | |||
|
993 | 1091 | ] |
|
994 | 1092 | |
|
995 | 1093 | [[package]] |
|
1094 | name = "pyo3" | |
|
1095 | version = "0.20.3" | |
|
1096 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1097 | checksum = "53bdbb96d49157e65d45cc287af5f32ffadd5f4761438b527b055fb0d4bb8233" | |
|
1098 | dependencies = [ | |
|
1099 | "cfg-if", | |
|
1100 | "indoc", | |
|
1101 | "libc", | |
|
1102 | "memoffset", | |
|
1103 | "parking_lot", | |
|
1104 | "portable-atomic", | |
|
1105 | "pyo3-build-config", | |
|
1106 | "pyo3-ffi", | |
|
1107 | "pyo3-macros", | |
|
1108 | "unindent", | |
|
1109 | ] | |
|
1110 | ||
|
1111 | [[package]] | |
|
1112 | name = "pyo3-build-config" | |
|
1113 | version = "0.20.3" | |
|
1114 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1115 | checksum = "deaa5745de3f5231ce10517a1f5dd97d53e5a2fd77aa6b5842292085831d48d7" | |
|
1116 | dependencies = [ | |
|
1117 | "once_cell", | |
|
1118 | "target-lexicon", | |
|
1119 | ] | |
|
1120 | ||
|
1121 | [[package]] | |
|
1122 | name = "pyo3-ffi" | |
|
1123 | version = "0.20.3" | |
|
1124 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1125 | checksum = "62b42531d03e08d4ef1f6e85a2ed422eb678b8cd62b762e53891c05faf0d4afa" | |
|
1126 | dependencies = [ | |
|
1127 | "libc", | |
|
1128 | "pyo3-build-config", | |
|
1129 | ] | |
|
1130 | ||
|
1131 | [[package]] | |
|
1132 | name = "pyo3-macros" | |
|
1133 | version = "0.20.3" | |
|
1134 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1135 | checksum = "7305c720fa01b8055ec95e484a6eca7a83c841267f0dd5280f0c8b8551d2c158" | |
|
1136 | dependencies = [ | |
|
1137 | "proc-macro2", | |
|
1138 | "pyo3-macros-backend", | |
|
1139 | "quote", | |
|
1140 | "syn 2.0.89", | |
|
1141 | ] | |
|
1142 | ||
|
1143 | [[package]] | |
|
1144 | name = "pyo3-macros-backend" | |
|
1145 | version = "0.20.3" | |
|
1146 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1147 | checksum = "7c7e9b68bb9c3149c5b0cade5d07f953d6d125eb4337723c4ccdb665f1f96185" | |
|
1148 | dependencies = [ | |
|
1149 | "heck 0.4.1", | |
|
1150 | "proc-macro2", | |
|
1151 | "pyo3-build-config", | |
|
1152 | "quote", | |
|
1153 | "syn 2.0.89", | |
|
1154 | ] | |
|
1155 | ||
|
1156 | [[package]] | |
|
996 | 1157 | name = "python3-sys" |
|
997 | 1158 | version = "0.7.2" |
|
998 | 1159 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1192,7 +1353,7 dependencies = [ | |||
|
1192 | 1353 | "chrono", |
|
1193 | 1354 | "clap", |
|
1194 | 1355 | "derive_more", |
|
1195 | "env_logger", | |
|
1356 | "env_logger 0.11.5", | |
|
1196 | 1357 | "format-bytes", |
|
1197 | 1358 | "hg-core", |
|
1198 | 1359 | "home", |
@@ -1250,6 +1411,12 dependencies = [ | |||
|
1250 | 1411 | ] |
|
1251 | 1412 | |
|
1252 | 1413 | [[package]] |
|
1414 | name = "scopeguard" | |
|
1415 | version = "1.2.0" | |
|
1416 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1417 | checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" | |
|
1418 | ||
|
1419 | [[package]] | |
|
1253 | 1420 | name = "self_cell" |
|
1254 | 1421 | version = "1.0.4" |
|
1255 | 1422 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1342,6 +1509,12 dependencies = [ | |||
|
1342 | 1509 | ] |
|
1343 | 1510 | |
|
1344 | 1511 | [[package]] |
|
1512 | name = "smallvec" | |
|
1513 | version = "1.13.2" | |
|
1514 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1515 | checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" | |
|
1516 | ||
|
1517 | [[package]] | |
|
1345 | 1518 | name = "stable_deref_trait" |
|
1346 | 1519 | version = "1.2.0" |
|
1347 | 1520 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1388,6 +1561,12 source = "registry+https://github.com/ru | |||
|
1388 | 1561 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" |
|
1389 | 1562 | |
|
1390 | 1563 | [[package]] |
|
1564 | name = "target-lexicon" | |
|
1565 | version = "0.12.16" | |
|
1566 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1567 | checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" | |
|
1568 | ||
|
1569 | [[package]] | |
|
1391 | 1570 | name = "tempfile" |
|
1392 | 1571 | version = "3.14.0" |
|
1393 | 1572 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1401,6 +1580,15 dependencies = [ | |||
|
1401 | 1580 | ] |
|
1402 | 1581 | |
|
1403 | 1582 | [[package]] |
|
1583 | name = "termcolor" | |
|
1584 | version = "1.4.1" | |
|
1585 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1586 | checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" | |
|
1587 | dependencies = [ | |
|
1588 | "winapi-util", | |
|
1589 | ] | |
|
1590 | ||
|
1591 | [[package]] | |
|
1404 | 1592 | name = "thiserror" |
|
1405 | 1593 | version = "1.0.69" |
|
1406 | 1594 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1500,6 +1688,12 source = "registry+https://github.com/ru | |||
|
1500 | 1688 | checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" |
|
1501 | 1689 | |
|
1502 | 1690 | [[package]] |
|
1691 | name = "unindent" | |
|
1692 | version = "0.2.3" | |
|
1693 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1694 | checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce" | |
|
1695 | ||
|
1696 | [[package]] | |
|
1503 | 1697 | name = "utf8parse" |
|
1504 | 1698 | version = "0.2.2" |
|
1505 | 1699 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1654,6 +1848,22 dependencies = [ | |||
|
1654 | 1848 | ] |
|
1655 | 1849 | |
|
1656 | 1850 | [[package]] |
|
1851 | name = "winapi" | |
|
1852 | version = "0.3.9" | |
|
1853 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1854 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" | |
|
1855 | dependencies = [ | |
|
1856 | "winapi-i686-pc-windows-gnu", | |
|
1857 | "winapi-x86_64-pc-windows-gnu", | |
|
1858 | ] | |
|
1859 | ||
|
1860 | [[package]] | |
|
1861 | name = "winapi-i686-pc-windows-gnu" | |
|
1862 | version = "0.4.0" | |
|
1863 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1864 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | |
|
1865 | ||
|
1866 | [[package]] | |
|
1657 | 1867 | name = "winapi-util" |
|
1658 | 1868 | version = "0.1.9" |
|
1659 | 1869 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -1663,6 +1873,12 dependencies = [ | |||
|
1663 | 1873 | ] |
|
1664 | 1874 | |
|
1665 | 1875 | [[package]] |
|
1876 | name = "winapi-x86_64-pc-windows-gnu" | |
|
1877 | version = "0.4.0" | |
|
1878 | source = "registry+https://github.com/rust-lang/crates.io-index" | |
|
1879 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" | |
|
1880 | ||
|
1881 | [[package]] | |
|
1666 | 1882 | name = "windows-core" |
|
1667 | 1883 | version = "0.52.0" |
|
1668 | 1884 | source = "registry+https://github.com/rust-lang/crates.io-index" |
General Comments 0
You need to be logged in to leave comments.
Login now