mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
entrypoint: remove mercurial.executionmodel
Summary: The only use of it is `util.gethgcmd`. With the previous patch, `util.gethgcmd()` is already correct using `sys.argv`. Therefore `executionmodel` is no longer necessary. Reviewed By: ikostia Differential Revision: D15856611 fbshipit-source-id: 622dc949b4911be44a53e5a2487a0121c781d82b
This commit is contained in:
parent
13a9ffa03f
commit
201c402023
@ -12,7 +12,7 @@ import os
|
||||
import sys
|
||||
|
||||
|
||||
def run(binaryexecution):
|
||||
def run():
|
||||
# entrypoint is in mercurial/ dir, while we want 'from mercurial import ...',
|
||||
# 'from hgext import ...' and 'from hgdemandimport import ...' to work
|
||||
# so we are adding their parent directory to be the first item of sys.path
|
||||
@ -53,10 +53,6 @@ def run(binaryexecution):
|
||||
if ipypath not in sys.path and os.path.exists(ipypath):
|
||||
sys.path.insert(0, ipypath)
|
||||
|
||||
from edenscm.mercurial import executionmodel
|
||||
|
||||
executionmodel.setbinaryexecution(binaryexecution)
|
||||
|
||||
if (
|
||||
sys.argv[1:5] == ["serve", "--cmdserver", "chgunix2", "--address"]
|
||||
and sys.argv[6:8] == ["--daemon-postexec", "chdir:/"]
|
||||
|
@ -1,11 +0,0 @@
|
||||
# Copyright 2018-present Facebook. All Rights Reserved.
|
||||
#
|
||||
# This software may be used and distributed according to the terms of the
|
||||
# GNU General Public License version 2 or any later version.
|
||||
|
||||
executedfrombinary = False
|
||||
|
||||
|
||||
def setbinaryexecution(isbinary=False):
|
||||
global executedfrombinary
|
||||
executedfrombinary = isbinary
|
@ -22,7 +22,7 @@ import sys
|
||||
import tempfile
|
||||
import unicodedata
|
||||
|
||||
from . import encoding, error, executionmodel, fscap, pycompat
|
||||
from . import encoding, error, fscap, pycompat
|
||||
from .cext import osutil
|
||||
from .i18n import _
|
||||
|
||||
@ -951,10 +951,6 @@ def spawndetached(args):
|
||||
|
||||
|
||||
def gethgcmd():
|
||||
# in case this is called from a Rust binary, the fist element of sys.argv
|
||||
# is entrypoint.py, which is not executable
|
||||
if executionmodel.executedfrombinary:
|
||||
return [sys.executable]
|
||||
return sys.argv[:1]
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ use crate::python::{
|
||||
py_finalize, py_init_threads, py_initialize, py_set_argv, py_set_no_site_flag,
|
||||
py_set_program_name, py_set_python_home,
|
||||
};
|
||||
use cpython::{exc, ObjectProtocol, PyBytes, PyObject, PyResult, Python};
|
||||
use cpython::{exc, NoArgs, ObjectProtocol, PyBytes, PyObject, PyResult, Python};
|
||||
use encoding::{osstring_to_local_cstring, path_to_local_bytes};
|
||||
use std;
|
||||
use std::ffi::{CString, OsStr, OsString};
|
||||
@ -273,7 +273,7 @@ impl HgPython {
|
||||
pub fn run_py(&self, py: Python<'_>) -> PyResult<()> {
|
||||
self.adjust_path(py)?;
|
||||
let entry_point_mod = py.import(HGPYENTRYPOINT_MOD)?;
|
||||
entry_point_mod.call(py, "run", (py.True(),), None)?;
|
||||
entry_point_mod.call(py, "run", NoArgs, None)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user