Skip to content

Commit 5c9f4d0

Browse files
authored
feat: Add command line argument for gyp --version (#164)
1 parent 44bd0dd commit 5c9f4d0

File tree

3 files changed

+47
-33
lines changed

3 files changed

+47
-33
lines changed

pylib/gyp/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
import traceback
1616
from gyp.common import GypError
1717

18+
19+
VERSION = "0.13.0"
20+
1821
# Default debug modes for GYP
1922
debug = {}
2023

@@ -463,8 +466,18 @@ def gyp_main(args):
463466
metavar="TARGET",
464467
help="include only TARGET and its deep dependencies",
465468
)
469+
parser.add_argument(
470+
"-V",
471+
"--version",
472+
dest="version",
473+
action="store_true",
474+
help="Show the version and exit.",
475+
)
466476

467477
options, build_files_arg = parser.parse_args(args)
478+
if options.version:
479+
print(f"v{VERSION}")
480+
return 0
468481
build_files = build_files_arg
469482

470483
# Set up the configuration directory (defaults to ~/.gyp)

setup.cfg

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[metadata]
2+
name = gyp-next
3+
version = attr: pylib/gyp.VERSION
4+
description = A fork of the GYP build system for use in the Node.js projects
5+
long_description = file: README.md
6+
long_description_content_type = text/markdown
7+
author=Node.js contributors
8+
author_email[email protected]
9+
url=https://github.com/nodejs/gyp-next
10+
license = BSD 3-Clause License
11+
classifiers =
12+
Development Status :: 3 - Alpha
13+
Environment :: Console
14+
Intended Audience :: Developers
15+
License :: OSI Approved :: BSD License
16+
Natural Language :: English
17+
Programming Language :: Python
18+
Programming Language :: Python :: 3
19+
Programming Language :: Python :: 3.6
20+
Programming Language :: Python :: 3.7
21+
Programming Language :: Python :: 3.8
22+
Programming Language :: Python :: 3.9
23+
Programming Language :: Python :: 3.10
24+
25+
[options]
26+
python_requires = 3.6
27+
package_dir=
28+
=pylib
29+
packages=gyp,gyp.generator
30+
31+
[options.entry_points]
32+
console_scripts =
33+
executable-name = gyp:script_main

setup.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,7 @@
44
# Use of this source code is governed by a BSD-style license that can be
55
# found in the LICENSE file.
66

7-
from os import path
8-
97
from setuptools import setup
108

11-
here = path.abspath(path.dirname(__file__))
12-
# Get the long description from the README file
13-
with open(path.join(here, "README.md")) as in_file:
14-
long_description = in_file.read()
159

16-
setup(
17-
name="gyp-next",
18-
version="0.13.0",
19-
description="A fork of the GYP build system for use in the Node.js projects",
20-
long_description=long_description,
21-
long_description_content_type="text/markdown",
22-
author="Node.js contributors",
23-
author_email="[email protected]",
24-
url="https://github.com/nodejs/gyp-next",
25-
package_dir={"": "pylib"},
26-
packages=["gyp", "gyp.generator"],
27-
entry_points={"console_scripts": ["gyp=gyp:script_main"]},
28-
python_requires=">=3.6",
29-
classifiers=[
30-
"Development Status :: 3 - Alpha",
31-
"Environment :: Console",
32-
"Intended Audience :: Developers",
33-
"License :: OSI Approved :: BSD License",
34-
"Natural Language :: English",
35-
"Programming Language :: Python",
36-
"Programming Language :: Python :: 3",
37-
"Programming Language :: Python :: 3.6",
38-
"Programming Language :: Python :: 3.7",
39-
"Programming Language :: Python :: 3.8",
40-
"Programming Language :: Python :: 3.9",
41-
],
42-
)
10+
setup()

0 commit comments

Comments
 (0)