2021-07-08 14:38:27 +00:00
|
|
|
#
|
|
|
|
# spec file for package pyright
|
|
|
|
#
|
|
|
|
# Copyright (c) Andreas Schneider <asn@cryptomilk.org>
|
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
2023-07-14 09:40:30 +00:00
|
|
|
|
2021-07-08 14:38:27 +00:00
|
|
|
%define pkg_name pyright
|
|
|
|
|
|
|
|
Name: nodejs-pyright
|
2024-07-01 08:40:13 +00:00
|
|
|
Version: 1.1.369
|
2021-07-08 14:38:27 +00:00
|
|
|
Release: 0
|
|
|
|
Summary: Type checker and LSP for the Python language
|
|
|
|
License: MIT
|
|
|
|
Url: https://github.com/microsoft/pyright
|
|
|
|
Source0: %{url}/archive/%{version}/%{pkg_name}-%{version}.tar.gz
|
|
|
|
# Create with `bash prepare_vendor.sh`
|
2023-07-14 09:40:30 +00:00
|
|
|
Source1: %{pkg_name}-%{version}-vendor.tar.zst
|
2021-07-08 14:38:27 +00:00
|
|
|
BuildRequires: dos2unix
|
|
|
|
BuildRequires: fdupes
|
2023-07-14 09:40:30 +00:00
|
|
|
BuildRequires: npm >= 16
|
|
|
|
BuildRequires: nodejs-packaging
|
|
|
|
BuildRequires: nodejs-devel
|
2021-07-08 14:38:27 +00:00
|
|
|
BuildRequires: rsync
|
2023-07-14 09:40:30 +00:00
|
|
|
BuildRequires: zstd
|
2024-07-01 08:25:43 +00:00
|
|
|
%if 0%{?suse_version}
|
2023-11-10 08:13:45 +00:00
|
|
|
BuildRequires: python311
|
2024-07-01 08:25:43 +00:00
|
|
|
BuildRequires: python311-setuptools
|
|
|
|
%else
|
|
|
|
BuildRequires: python3-setuptools
|
|
|
|
%endif
|
2021-07-08 14:38:27 +00:00
|
|
|
BuildArch: noarch
|
|
|
|
|
|
|
|
%description
|
|
|
|
Pyright is a fast type checker meant for large Python source bases. It can run
|
|
|
|
in a “watch” mode and performs fast incremental updates when files are
|
|
|
|
modified.
|
|
|
|
|
|
|
|
Pyright provides support for Python 3.0 and newer.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%autosetup -n %{pkg_name}-%{version} -a1 -p1
|
|
|
|
|
|
|
|
sed -i '/"postinstall": .*/d' package.json
|
|
|
|
dos2unix README.md
|
|
|
|
|
|
|
|
%build
|
2023-11-10 08:13:45 +00:00
|
|
|
export PATH="$(pwd)/node_modules/.bin:$(pwd)/packages/pyright/node_modules/.bin:$PATH"
|
2023-07-14 09:40:30 +00:00
|
|
|
export NODEJS_MAJOR_VERSION=$(echo %nodejs_version | sed 's/\..*//')
|
|
|
|
|
2024-07-01 08:25:43 +00:00
|
|
|
%if 0%{?suse_version}
|
2023-07-14 09:40:30 +00:00
|
|
|
export npm_config_nodedir="%{_includedir}/node${NODEJS_MAJOR_VERSION}"
|
2024-07-01 08:25:43 +00:00
|
|
|
%else
|
|
|
|
export npm_config_nodedir="%{_includedir}/node"
|
|
|
|
%endif
|
2023-07-14 09:40:30 +00:00
|
|
|
export npm_config_build_from_source=true
|
|
|
|
|
|
|
|
export CFLAGS="%{optflags} -I${npm_config_nodedir}"
|
|
|
|
export CXXFLAGS="%{optflags} -I${npm_config_nodedir}"
|
2021-07-08 14:38:27 +00:00
|
|
|
|
|
|
|
### Rebuild node modules from source
|
|
|
|
pushd node_modules
|
|
|
|
npm rebuild
|
|
|
|
popd
|
|
|
|
|
2023-11-10 08:13:45 +00:00
|
|
|
pushd packages/%{pkg_name}/
|
2021-07-08 14:38:27 +00:00
|
|
|
npm run build
|
|
|
|
popd
|
|
|
|
|
|
|
|
%install
|
2023-07-14 09:40:30 +00:00
|
|
|
export NODEJS_DEFAULT_VER=$(echo %nodejs_version | sed 's/\..*//')
|
|
|
|
|
2021-07-08 14:38:27 +00:00
|
|
|
install -d -m 0755 %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/
|
|
|
|
|
|
|
|
sed -i 's#!/usr/bin/env node#!/usr/bin/node#' packages/%{pkg_name}/index.js
|
|
|
|
sed -i 's#!/usr/bin/env node#!/usr/bin/node#' packages/%{pkg_name}/langserver.index.js
|
|
|
|
rsync -av \
|
|
|
|
packages/%{pkg_name}/dist \
|
|
|
|
packages/%{pkg_name}/index.js \
|
|
|
|
packages/%{pkg_name}/langserver.index.js \
|
|
|
|
%{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}/
|
|
|
|
|
|
|
|
install -d -m 0755 %{buildroot}%{_bindir}
|
|
|
|
ln -s %{_prefix}/lib/node_modules/%{pkg_name}/index.js %{buildroot}%{_bindir}/%{pkg_name}
|
|
|
|
ln -s %{_prefix}/lib/node_modules/%{pkg_name}/langserver.index.js %{buildroot}%{_bindir}/%{pkg_name}-langserver
|
|
|
|
|
|
|
|
find %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name} -type f -size 0 -delete
|
|
|
|
%fdupes %{buildroot}%{_prefix}/lib/node_modules/%{pkg_name}
|
|
|
|
|
2021-07-20 06:32:29 +00:00
|
|
|
%check
|
|
|
|
npm run check
|
|
|
|
|
2021-07-08 14:38:27 +00:00
|
|
|
%files
|
|
|
|
%license LICENSE.txt
|
|
|
|
%doc CONTRIBUTING.md README.md
|
|
|
|
%{_bindir}/%{pkg_name}
|
|
|
|
%{_bindir}/%{pkg_name}-langserver
|
|
|
|
%dir %{_prefix}/lib/node_modules
|
|
|
|
%{_prefix}/lib/node_modules/%{pkg_name}/
|
|
|
|
|
|
|
|
%changelog
|