WIP: dev #6
| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
import hashlib
 | 
			
		||||
import shlex
 | 
			
		||||
import socket
 | 
			
		||||
from pathlib import Path
 | 
			
		||||
 | 
			
		||||
from joj3_config_generator.models import joj1, repo, result, task
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -80,7 +81,10 @@ def calc_sha256sum(file_path: str) -> str:
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def get_hash(immutable_files: list[str]) -> str:  # input should be a list
 | 
			
		||||
    file_path = "../immutable_file/"  # TODO: change this when things are on the server
 | 
			
		||||
    # FIXME: should be finalized when get into the server
 | 
			
		||||
    current_file_path = Path(__file__).resolve()
 | 
			
		||||
    project_root = current_file_path.parents[2]
 | 
			
		||||
    file_path = f"{project_root}/tests/immutable_file/"
 | 
			
		||||
| 
					
	
	
	
	
	
	
	
	 | 
			||||
    immutable_hash = []
 | 
			
		||||
    for i, file in enumerate(immutable_files):
 | 
			
		||||
        immutable_files[i] = file_path + file.rsplit("/", 1)[-1]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user
	
hard coded path not acceptable
thats what I wanted to discuss, in what form would be better? @manuel @bomingzh
my suggestions is to add more fields related to this in
repo.tomlortask.toml, I think store it globally in some*.pyfile is still hardcodedjust let them enter path relative to project root for immutable files
giving prompt? Wouldn't it be better to export field in
*.tomlfile? they may accidnetally input wrong things I guessjust throw error on wrong input
I mean, they input
\home\tt\.config\instead of\home\tt\.config\jojsuch things may happen, but will cost time to figure out what happened? So I think better put them in*.toml.just make the dir relative to git repo root, if the file does not exist, throw error
any path in toml should probably be defined relative to
/home/tt/.config/jojand be in a subdirectory. this is where all config must be.then they can specify
projects/p2/.cang-tidyortool/compileusing
project_rootas too tricky as it could mean going up (../../) which is hard to read/figure out quickly.as all JOJ config files must be in
$HOME/.config/jojtaking it as root makes sense, is general, and consistent with the approach we have used so farbit mixed here, if fixed, can I hardcode it?