speedup travis by avoid nix-shell for scripts

At the moment many build-time dependencies are downloaded.
This commit is contained in:
Jörg Thalheim 2018-08-13 10:23:22 +02:00
parent 2992592d05
commit d2e3c33ba7
4 changed files with 71 additions and 5 deletions

View file

@ -20,15 +20,17 @@ fi
export encrypted_080f214a372c_key= encrypted_080f214a372c_iv=
./bin/nur format-manifest
nix-build release.nix
result/bin/nur format-manifest
if [ -n "$(git diff --exit-code repos.json)" ]; then
echo "repos.json was not formatted before committing repos.json:" >&2
git diff --exit-code repos.json
echo "Please run ./nur/format-manifest.py and updates repos.json accordingly!" >&2
echo "Please run ./bin/nur/format-manifest.py and updates repos.json accordingly!" >&2
exit 1
fi
./bin/nur update
result/bin/nur update
nix-build
# Pull requests and commits to other branches shouldn't try to deploy, just build to verify
@ -44,7 +46,7 @@ git config --global commit.gpgsign true
git clone git@github.com:nix-community/nur-channel
./bin/nur build-channel nur-channel
result/bin/nur build-channel nur-channel
if [[ -z "$(git diff --exit-code)" ]]; then
echo "No changes to the output on this push; exiting."

View file

@ -1,7 +1,34 @@
import os
import subprocess
from pathlib import Path
ROOT = Path(__file__).parent.parent.resolve()
from .error import NurError
def _is_repo(path: Path) -> bool:
return path.joinpath("lib/evalRepo.nix").exists()
def _find_root() -> Path:
source_root = Path(__file__).parent.parent.resolve()
if _is_repo(source_root):
# if it was not build with release.nix
return source_root
else:
root = Path(os.getcwd()).resolve()
while True:
if _is_repo(root):
return root
new_root = root.parent.resolve()
if new_root == root:
if _is_repo(new_root):
return new_root
else:
raise NurError("NUR repository not found in current directory")
ROOT = _find_root()
LOCK_PATH = ROOT.joinpath("repos.json.lock")
MANIFEST_PATH = ROOT.joinpath("repos.json")
EVALREPO_PATH = ROOT.joinpath("lib/evalRepo.nix")

12
release.nix Normal file
View file

@ -0,0 +1,12 @@
{ nixpkgs ? import <nixpkgs> }:
with import <nixpkgs> {};
python3Packages.buildPythonApplication {
name = "nur";
src = ./.;
makeWrapperArgs = [
"--prefix" "PATH" ":" "${stdenv.lib.makeBinPath [ nix-prefetch-git git nix ]}"
];
}

25
setup.py Normal file
View file

@ -0,0 +1,25 @@
#!/usr/bin/env python
from setuptools import setup, find_packages
import sys
assert sys.version_info >= (3, 6, 0), "nur requires Python 3.6+"
setup(
name="nur",
version="0.0.1",
description="Tooling to maintain NUR",
author="Jörg Thalheim",
author_email="joerg@thalheim.io",
url="https://github.com/nix-community/nur",
license="MIT",
packages=find_packages(),
entry_points={"console_scripts": ["nur = nur:main"]},
extras_require={"dev": ["mypy", "flake8>=3.5,<3.6", "black"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Topic :: Utilities",
"Intended Audience :: Developers",
"Programming Language :: Python :: 3.6",
],
)