mirror of
https://src.fedoraproject.org/rpms/nodejs18.git
synced 2024-11-24 17:44:23 +00:00
%nodejs_symlink_deps improvements
-support installing multiple modules from the same SRPM -drop name argument rendered useless by the above -support a --check argument that works in the current working directory instead of $RPM_BUILD_ROOT
This commit is contained in:
parent
7cb1934a64
commit
b22ee6fcc9
2 changed files with 23 additions and 17 deletions
|
@ -3,7 +3,7 @@
|
|||
"""Symlink a node module's dependencies into the node_modules directory so users
|
||||
can `npm link` RPM-installed modules into their personal projects."""
|
||||
|
||||
# Copyright 2012 T.C. Hollingsworth <tchollingsworth@gmail.com>
|
||||
# Copyright 2012, 2013 T.C. Hollingsworth <tchollingsworth@gmail.com>
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
|
@ -30,16 +30,19 @@ import sys
|
|||
#the %nodejs_symlink_deps macro passes %nodejs_sitelib as the first argument
|
||||
sitelib = sys.argv[1]
|
||||
|
||||
metadata = json.load(open('package.json'))
|
||||
|
||||
if len(sys.argv) > 2:
|
||||
name = sys.argv[2]
|
||||
if '--check' in sys.argv:
|
||||
check = True
|
||||
modules = [os.getcwd()]
|
||||
else:
|
||||
name = metadata['name']
|
||||
check = False
|
||||
br_sitelib = os.path.join(os.environ['RPM_BUILD_ROOT'], sitelib.lstrip('/'))
|
||||
modules = [os.path.join(br_sitelib, module) for module in os.listdir(br_sitelib)]
|
||||
|
||||
os.chdir(os.path.join(os.environ['RPM_BUILD_ROOT'], sitelib.lstrip('/'), name))
|
||||
for path in modules:
|
||||
os.chdir(path)
|
||||
md = json.load(open('package.json'))
|
||||
|
||||
if 'dependencies' in metadata:
|
||||
if 'dependencies' in md:
|
||||
try:
|
||||
os.mkdir('node_modules')
|
||||
except OSError:
|
||||
|
@ -48,5 +51,5 @@ if 'dependencies' in metadata:
|
|||
|
||||
os.chdir('node_modules')
|
||||
|
||||
for dep in metadata['dependencies'].iterkeys():
|
||||
for dep in md['dependencies'].iterkeys():
|
||||
os.symlink(os.path.join(sitelib, dep), dep)
|
||||
|
|
|
@ -194,6 +194,9 @@ cp -p common.gypi %{buildroot}%{_datadir}/node
|
|||
- remove %%nodejs_arches macro since it will only be useful if it is present in
|
||||
the redhat-rpm-config package
|
||||
- add default filtering macro to remove unwanted Provides from native modules
|
||||
- nodejs-symlink-deps now supports multiple modules in one SRPM properly
|
||||
- nodejs-symlink-deps also now supports a --check argument that works in the
|
||||
current working directry instead of the buildroot
|
||||
|
||||
* Fri Mar 22 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 0.10.1-1
|
||||
- new upstream release 0.10.1
|
||||
|
|
Loading…
Reference in a new issue