import os

def FlagsForFile(filename, **kwargs):

    flags = ['-std=c++14', '-I/usr/local/include']

    proj_root = os.path.dirname(os.path.abspath(__file__))
    libcanon_include = ''.join(['-I', proj_root, '/deps/libcanon/include'])
    proj_include = ''.join(['-I', proj_root, '/drudge'])
    flags.extend([libcanon_include, proj_include])

    return {'flags': flags}

import os
import subprocess

def FlagsForFile(filename, **kwargs):

    flags = ['-std=c++14', '-I/usr/local/include']

    proj_root = os.path.dirname(os.path.abspath(__file__))
    libcanon_include = ''.join(['-I', proj_root, '/deps/libcanon/include'])
    python_include = subprocess.run(
        ["pkg-config", '--cflags', 'python3'], stdout=subprocess.PIPE
    ).stdout.decode("utf-8")
    proj_include = ''.join(['-I', proj_root, '/drudge'])
    flags.extend([libcanon_include, proj_include])

    return {'flags': flags}

Add Python inclusion path to YCM config
Add Python inclusion path to YCM config

In the script, the path is read from the result from pkg-config.  So it
should work in most places.

  import os
+ import subprocess
  
  def FlagsForFile(filename, **kwargs):
  
      flags = ['-std=c++14', '-I/usr/local/include']
  
      proj_root = os.path.dirname(os.path.abspath(__file__))
      libcanon_include = ''.join(['-I', proj_root, '/deps/libcanon/include'])
+     python_include = subprocess.run(
+         ["pkg-config", '--cflags', 'python3'], stdout=subprocess.PIPE
+     ).stdout.decode("utf-8")
      proj_include = ''.join(['-I', proj_root, '/drudge'])
      flags.extend([libcanon_include, proj_include])
  
      return {'flags': flags}
  
Add Python inclusion path to YCM config
## Code Before:
import os

def FlagsForFile(filename, **kwargs):

    flags = ['-std=c++14', '-I/usr/local/include']

    proj_root = os.path.dirname(os.path.abspath(__file__))
    libcanon_include = ''.join(['-I', proj_root, '/deps/libcanon/include'])
    proj_include = ''.join(['-I', proj_root, '/drudge'])
    flags.extend([libcanon_include, proj_include])

    return {'flags': flags}

## Instruction:
Add Python inclusion path to YCM config
## Code After:
import os
import subprocess

def FlagsForFile(filename, **kwargs):

    flags = ['-std=c++14', '-I/usr/local/include']

    proj_root = os.path.dirname(os.path.abspath(__file__))
    libcanon_include = ''.join(['-I', proj_root, '/deps/libcanon/include'])
    python_include = subprocess.run(
        ["pkg-config", '--cflags', 'python3'], stdout=subprocess.PIPE
    ).stdout.decode("utf-8")
    proj_include = ''.join(['-I', proj_root, '/drudge'])
    flags.extend([libcanon_include, proj_include])

    return {'flags': flags}
