moved src

This commit is contained in:
raghuram 2021-10-08 15:12:55 +00:00
parent 1dc003e2e5
commit 0ca35d09ad
6 changed files with 171 additions and 1 deletions

View File

@ -1,4 +1,5 @@
import json
from jsonschema import validate
import os
import re
import subprocess as sp
@ -324,6 +325,7 @@ class PackageCommand(Command):
lock['generic']['sourcesCombinedHash'] = hash
# re-write dream.lock
checkLockJSON(order_dict(lock))
with open(outputDreamLock, 'w') as f:
json.dump(order_dict(lock), f, indent=2)
@ -340,6 +342,21 @@ class PackageCommand(Command):
print(f"Created {output}/{{dream.lock,default.nix}}")
def checkLockJSON(lock):
try:
lock_schema_raw=open(dream2nix_src+"/specifications/dream-lock-schema.json").read()
lock_schema=json.loads(lock_schema_raw)
except Exception as e:
print(e)
num=0
for i in lock:
try:
validate(i,schema=lock_schema)
num = num +1
except Exception as e1:
print(e1)
print(num)
def callNixFunction(function_path, **kwargs):

View File

@ -16,7 +16,7 @@ let
b = builtins;
cliPython = python3.withPackages (ps: [ ps.networkx ps.cleo ]);
cliPython = python3.withPackages (ps: [ ps.networkx ps.cleo ps.jsonschema ]);
in
{

View File

@ -0,0 +1,38 @@
{
"sources": {
"requests": {
"url": "https://download.pypi.org/requests/2.28.0",
"hash": "000000000000000000000000000000000000000",
"version": "1.2.3",
"type": "fetchurl"
},
"certifi": {
"url": "https://download.pypi.org/certifi/2.0",
"hash": "000000000000000000000000000000000000000",
"version": "2.3.4",
"type": "fetchurl"
}
},
"generic": {
"buildSystem": "python",
"translatedBy": "python.pure.poetry",
"translatorParams": "--flag_application",
"mainPackage": "requests",
"dependencyCyclesRemoved": true,
"dependencyGraph": {
"requests": [
"certifi"
]
},
"sourcesCombinedHash": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
},
"buildSystem": {
"pythonAttr": "python38",
"sourceFormats": {
"requests": "sdist",
"certifi": "wheel"
}
}
}

View File

@ -0,0 +1,96 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "manifest",
"type": "object",
"properties": {
"sources": {
"type": "object",
"patternProperties": {
"^.*$": {
"type": "object",
"properties": {
"type": {
"enum": [
"fetchurl",
"git",
"github",
"gitlab"
]
},
"url": {
"type": "string"
},
"hash": {
"type": "string"
}
},
"allOf": [
{
"if": {
"properties": { "type": { "const": "unknown" } }
},
"then": { "properties": {} }
},
{
"if": {
"properties": { "type": { "const": "fetchurl" } }
},
"then": {
"properties": { "url": { "type": "string" } }
}
},
{
"if": {
"properties": { "type": { "const": "git" } }
},
"then": {
"properties": {
"url": { "type": "string" },
"rev": { "type": "string" }
}
}
},
{
"if": {
"properties": { "type": { "pattern": "(github)|(gitlab)" } }
},
"then": {
"properties": {
"owner": { "type": "string" },
"repo": { "type": "string" },
"rev": { "type": "string" }
}
}
}
]
}
}
},
"generic": {
"type": "object",
"properties": {
"buildSystem": { "type": "string" },
"producedBy": { "type": "string" },
"dependencyGraph": {
"type": "object",
"properties": {
"^.*$": {
"type": "array",
"items": { "type": "string" }
}
}
}
}
},
"buildSystem": {
"description": "build system specifics",
"type": "object"
}
}
}

View File

@ -0,0 +1,5 @@
{
"buildSystem": {
"nodejsVersion": 14
}
}

View File

@ -0,0 +1,14 @@
{
"inputDirectories": [
"./some_project_src"
],
"inputFiles": [
"./a/b/c/requirements.txt",
"./a/b/c/requirements-dev.txt"
],
"outputFile": [
"./a/b/c/dream.lock"
]
}