Bases: object
Repository class gives information about the repository and projects in that repository.
The Repository class helps:
- Get a list of project names in the current repository
- Find server paths
- and some auxiliary things like:
- convert the given path to repository relative path which contains the environment variable key in the repository path.
In the current design of the system there can only be one repository where all the projects are saved on. It is a little bit hard or adventurous to build a system which supports multiple repositories.
Note
In future may there be support for multiple repositories by using repository specific environment variables, like $REPO1 for repository in the first index of the config.repository settings and $REPO2 for the second and etc. But in the current design it was a little bit an overkill to add this support.
Warning
The repository setting (repository) in the users own config.py file is useless for getting the repository path. It is the $REPO environment variable that oyProjectManager uses. The repository setting in the config.py is there to be able replace the path values for one operating system in another, for example, think that a path for a texture file is set to “/mnt/Projects/TestProject/Texture1”. This is obviously a path for OSX or linux, but what happens when you are under Windows and open the file, in this case oyProjectManager will try to replace the path with the environment variable by checking if the path matches any of the oses repository path settings and it will reproduce the path as “$REPO/TestProject” in case the repository settings is “/mnt/Projects” for OSX.
There are no parameters that needs to be set to initialize a Repository instance.
Methods
__init__() | |
get_project_name(file_path) | Returns the project name from the given path or full path. |
relative_path(path) | Converts the given path to repository relative path. |
update_project_list() | updates the project list variable |
Attributes
linux_path | |
osx_path | The osx path of the jobs server |
server_path | The server path |
windows_path | The windows path of the jobs server |
Returns the project name from the given path or full path.
Calculates the project name from the given file or folder full path. It returns None if it can not get a suitable name.
Parameters: | file_path (str) – The file or folder path. |
---|---|
Returns: | Returns a string containing the name of the project |
Return type: | str |