Skip to content

Commit ee84aed

Browse files
committed
Merge branch 'add-ninja_syntax'
* add-ninja_syntax: Bundle "ninja_syntax.py" into the distributions
2 parents 7b1af3e + c898bcb commit ee84aed

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -155,5 +155,6 @@ else()
155155

156156
endif()
157157

158-
install(PROGRAMS ${ninja_executable} DESTINATION bin)
158+
install(FILES ${Ninja_SOURCE_DIR}/misc/ninja_syntax.py DESTINATION ninja)
159+
install(PROGRAMS ${ninja_executable} DESTINATION ninja/data/bin)
159160

README.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ Ninja Python Distributions
1313

1414
`Ninja <http://www.ninja-build.org>`_ is a small build system with a focus on speed.
1515

16-
The Ninja python wheels provide `ninja 1.7.2 <https://ninja-build.org/manual.html>`_.
16+
The Ninja python wheels provide `ninja 1.7.2 <https://ninja-build.org/manual.html>`_ executable
17+
and `ninja_syntax.py` for generating .ninja files.
1718

1819
This project is maintained by Jean-Christophe Fillion-Robin from Kitware Inc.
1920
It is covered by the `Apache License, Version 2.0 <http://www.apache.org/licenses/LICENSE-2.0>`_.

ninja/__init__.py

+10
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,16 @@
77
__version__ = get_versions()['version']
88
del get_versions
99

10+
try:
11+
from .ninja_syntax import Writer, escape, expand # noqa: F401
12+
except ImportError:
13+
# Support importing `ninja_syntax` from the source tree
14+
if not os.path.exists(
15+
os.path.join(os.path.dirname(__file__), 'ninja_syntax.py')):
16+
sys.path.insert(0, os.path.abspath(os.path.join(
17+
os.path.dirname(__file__), '../src/misc')))
18+
from ninja_syntax import Writer, escape, expand # noqa: F401
19+
1020
DATA = os.path.join(os.path.dirname(__file__), 'data')
1121

1222
# Support running tests from the source tree

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ def _parse_requirements(filename):
3939

4040
packages=['ninja'],
4141

42-
cmake_install_dir='ninja/data',
4342
cmake_with_sdist=True,
4443

4544
entry_points={

0 commit comments

Comments
 (0)