@@ -59,7 +59,7 @@ module fpm_dependency
59
59
use fpm_environment, only: get_os_type, OS_WINDOWS, os_is_unix
60
60
use fpm_error, only: error_t, fatal_error
61
61
use fpm_filesystem, only: exists, join_path, mkdir, canon_path, windows_path, list_files, is_dir, basename, &
62
- os_delete_dir, get_temp_filename
62
+ os_delete_dir, get_temp_filename, parent_dir
63
63
use fpm_git, only: git_target_revision, git_target_default, git_revision, serializable_t
64
64
use fpm_manifest, only: package_config_t, dependency_config_t, get_package_data
65
65
use fpm_manifest_dependency, only: manifest_has_changed, dependency_destroy
@@ -130,6 +130,8 @@ module fpm_dependency
130
130
type (dependency_node_t), allocatable :: dep(:)
131
131
! > Cache file
132
132
character (len= :), allocatable :: cache
133
+ ! > Custom path to the global config file
134
+ character (len= :), allocatable :: path_to_config
133
135
134
136
contains
135
137
@@ -198,13 +200,15 @@ module fpm_dependency
198
200
contains
199
201
200
202
! > Create a new dependency tree
201
- subroutine new_dependency_tree (self , verbosity , cache )
203
+ subroutine new_dependency_tree (self , verbosity , cache , path_to_config )
202
204
! > Instance of the dependency tree
203
205
type (dependency_tree_t), intent (out ) :: self
204
206
! > Verbosity of printout
205
207
integer , intent (in ), optional :: verbosity
206
208
! > Name of the cache file
207
209
character (len=* ), intent (in ), optional :: cache
210
+ ! > Path to the global config file.
211
+ character (len=* ), intent (in ), optional :: path_to_config
208
212
209
213
call resize(self% dep)
210
214
self% dep_dir = join_path(" build" , " dependencies" )
@@ -213,6 +217,8 @@ subroutine new_dependency_tree(self, verbosity, cache)
213
217
214
218
if (present (cache)) self% cache = cache
215
219
220
+ if (present (path_to_config)) self% path_to_config = path_to_config
221
+
216
222
end subroutine new_dependency_tree
217
223
218
224
! > Create a new dependency node from a configuration
@@ -566,8 +572,24 @@ subroutine resolve_dependencies(self, root, error)
566
572
type (error_t), allocatable , intent (out ) :: error
567
573
568
574
type (fpm_global_settings) :: global_settings
575
+ character (:), allocatable :: parent_directory
569
576
integer :: ii
570
577
578
+ ! Register path to global config file if it was entered via the command line.
579
+ if (allocated (self% path_to_config)) then
580
+ if (len_trim (self% path_to_config) > 0 ) then
581
+ parent_directory = parent_dir(self% path_to_config)
582
+
583
+ if (len_trim (parent_directory) == 0 ) then
584
+ global_settings% path_to_config_folder = " ."
585
+ else
586
+ global_settings% path_to_config_folder = parent_directory
587
+ end if
588
+
589
+ global_settings% config_file_name = basename(self% path_to_config)
590
+ end if
591
+ end if
592
+
571
593
call get_global_settings(global_settings, error)
572
594
if (allocated (error)) return
573
595
@@ -695,7 +717,7 @@ subroutine get_from_registry(self, target_dir, global_settings, error, downloade
695
717
end if
696
718
697
719
! Include namespace and package name in the target url and download package data.
698
- target_url = global_settings% registry_settings% url// ' packages/' // self% namespace// ' /' // self% name
720
+ target_url = global_settings% registry_settings% url// ' / packages/' // self% namespace// ' /' // self% name
699
721
call downloader% get_pkg_data(target_url, self% requested_version, tmp_file, json, error)
700
722
close (unit, status= ' delete' )
701
723
if (allocated (error)) return
0 commit comments