git.iko.soy/typeable/nixpkgs
on master help sign in
ycmd: 2016-01-12 -> 2017-02-03

Also, remove wrapper bash script and symlink completion backends to ycmd can find them.

commitb27edc45374309fb30b6b7454b4115e4923b17bf authorCharles Strahan <charles@cstrahan.com> dateMon 6 Feb 2017, 02:43 (10 years ago) parent26e5b42
1 file changed+55−8
pkgs/development/tools/misc/ycmd/default.nix+55−8
pkgs/development/tools/misc/ycmd/default.nix+55−8
@@ -1,21 +1,26 @@
1−{ stdenv, fetchgit, cmake, llvmPackages, boost, python2Packages
1+{ stdenv, lib, fetchgit, cmake, llvmPackages, boost, python2Packages
2+, gocode ? null
3+, godef ? null
4+, rustracerd ? null
25}:
36
47let
5− inherit (python2Packages) python mkPythonDerivation waitress frozendict bottle;
8+ inherit (python2Packages) python mkPythonDerivation waitress frozendict bottle future argparse requests;
9+ pathFixup = "import os; os.environ['PATH'] = ('{0}:{1}' if os.getenv('PATH', '') != '' else '{1}').format('$program_PATH', os.getenv('PATH', ''))";
610in mkPythonDerivation rec {
7− name = "ycmd-2016-01-12";
11+ name = "ycmd-${version}";
12+ version = "2017-02-03";
813 namePrefix = "";
914
1015 src = fetchgit {
1116 url = "git://github.com/Valloric/ycmd.git";
12− rev = "f982f6251c5ff85e3abe6e862aad8bcd19e85ece";
13− sha256 = "1g0hivv3wla7z5dgnkcn3ny38p089pjfj36nx6k29zmprgmjinyr";
17+ rev = "ec7a154f8fe50c071ecd0ac6841de8a50ce92f5d";
18+ sha256 = "0rzxgqqqmmrv9r4k2ji074iprhw6sb0jkvh84wvi45yfyphsh0xi";
1419 };
1520
1621 buildInputs = [ cmake boost ];
1722
18− propagatedBuildInputs = [ waitress frozendict bottle ];
23+ propagatedBuildInputs = [ waitress frozendict bottle future argparse requests ];
1924
2025 buildPhase = ''
2126 export EXTRA_CMAKE_ARGS=-DPATH_TO_LLVM_ROOT=${llvmPackages.clang-unwrapped}
@@ -24,10 +29,52 @@ in mkPythonDerivation rec {
2429
2530 configurePhase = ":";
2631
32+ # remove the tests
33+ #
34+ # make __main__.py executable so mkPythonDerivation's postFixup modifies the
35+ # executable (e.g. fixup PYTHONPATH)
36+ #
37+ # add a shebang (will be rewritten by postFixup)
38+ #
39+ # symlink completion backends where ycmd expects them
2740 installPhase = ''
28− mkdir -p $out/lib/ycmd/third_party $out/bin
29− cp -r ycmd/ CORE_VERSION libclang.so.* ycm_client_support.so ycm_core.so $out/lib/ycmd/
41+ rm -rf ycmd/tests
42+
43+ chmod +x ycmd/__main__.py
44+ sed -i "1i #!/usr/bin/env python\
45+ " ycmd/__main__.py
46+
47+ mkdir -p $out/lib/ycmd
48+ cp -r ycmd/ CORE_VERSION libclang.so.* ycm_core.so $out/lib/ycmd/
49+
50+ mkdir -p $out/bin
3051 ln -s $out/lib/ycmd/ycmd/__main__.py $out/bin/ycmd
52+
53+ mkdir -p $out/lib/ycmd/third_party/{gocode,godef,racerd/target/release}
54+ cp -r third_party/JediHTTP/ $out/lib/ycmd/third_party
55+ '' + lib.optionalString (gocode != null) ''
56+ ln -s ${gocode}/bin/gocode $out/lib/ycmd/third_party/gocode
57+ '' + lib.optionalString (godef != null) ''
58+ ln -s ${godef}/bin/godef $out/lib/ycmd/third_party/godef
59+ '' + lib.optionalString (rustracerd != null) ''
60+ ln -s ${rustracerd}/bin/racerd $out/lib/ycmd/third_party/racerd/target/release
61+ '';
62+
63+ # mkPythonDerivation will attempt to create a wrapper script (written in bash)
64+ # but we don't want the indirection as several editor plugins want to invoke
65+ # ycmd as `python path/to/ycmd`, which will obviously fail in that case -
66+ # so we move the original file back over
67+ #
68+ # also fixup the argv[0] and replace __file__ with the corresponding path so
69+ # python won't be thrown off by argv[0]
70+ postFixup = ''
71+ mv $out/lib/ycmd/ycmd/{.__main__.py-wrapped,__main__.py}
72+
73+ substituteInPlace $out/lib/ycmd/ycmd/__main__.py \
74+ --replace $out/lib/ycmd/ycmd/__main__.py \
75+ $out/bin/ycmd \
76+ --replace __file__ \
77+ "'$out/lib/ycmd/ycmd/__main__.py'"
3178 '';
3279
3380 meta = with stdenv.lib; {