Skip to content

Commit 29ea77f

Browse files
committed
Improve variable names again
1 parent cd9e5c6 commit 29ea77f

File tree

3 files changed

+32
-31
lines changed

3 files changed

+32
-31
lines changed

src/fpm/dependency.f90

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ subroutine get_from_registry(self, target_dir, global_settings, error, downloade
614614
!> Downloader instance.
615615
class(downloader_t), optional, intent(in) :: downloader_
616616

617-
character(:), allocatable :: cache_path, target_url, tmp_pkg_data_path, tmp_pkg_data_file
617+
character(:), allocatable :: cache_path, target_url, tmp_pkg_path, tmp_pkg_file
618618
type(version_t) :: version
619619
integer :: stat, unit
620620
type(json_object) :: json
@@ -644,17 +644,17 @@ subroutine get_from_registry(self, target_dir, global_settings, error, downloade
644644
end if
645645

646646
! Define location of the temporary folder and file.
647-
tmp_pkg_data_path = join_path(global_settings%path_to_config_folder, 'tmp')
648-
tmp_pkg_data_file = join_path(tmp_pkg_data_path, 'package_data.tmp')
649-
if (.not. exists(tmp_pkg_data_path)) call mkdir(tmp_pkg_data_path)
650-
open (newunit=unit, file=tmp_pkg_data_file, action='readwrite', iostat=stat)
647+
tmp_pkg_path = join_path(global_settings%path_to_config_folder, 'tmp')
648+
tmp_pkg_file = join_path(tmp_pkg_path, 'package_data.tmp')
649+
if (.not. exists(tmp_pkg_path)) call mkdir(tmp_pkg_path)
650+
open (newunit=unit, file=tmp_pkg_file, action='readwrite', iostat=stat)
651651
if (stat /= 0) then
652652
call fatal_error(error, "Error creating temporary file for downloading package '"//self%name//"'."); return
653653
end if
654654

655655
! Include namespace and package name in the target url and download package data.
656656
target_url = global_settings%registry_settings%url//'/packages/'//self%namespace//'/'//self%name
657-
call downloader%get_pkg_data(target_url, self%requested_version, tmp_pkg_data_file, json, error)
657+
call downloader%get_pkg_data(target_url, self%requested_version, tmp_pkg_file, json, error)
658658
close (unit, status='delete')
659659
if (allocated(error)) return
660660

@@ -663,7 +663,7 @@ subroutine get_from_registry(self, target_dir, global_settings, error, downloade
663663
if (allocated(error)) return
664664

665665
! Open new tmp file for downloading the actual package.
666-
open (newunit=unit, file=tmp_pkg_data_file, action='readwrite', iostat=stat)
666+
open (newunit=unit, file=tmp_pkg_file, action='readwrite', iostat=stat)
667667
if (stat /= 0) then
668668
call fatal_error(error, "Error creating temporary file for downloading package '"//self%name//"'."); return
669669
end if
@@ -675,13 +675,13 @@ subroutine get_from_registry(self, target_dir, global_settings, error, downloade
675675
call mkdir(cache_path)
676676

677677
print *, "Downloading '"//join_path(self%namespace, self%name, version%s())//"' ..."
678-
call downloader%get_file(target_url, tmp_pkg_data_file, error)
678+
call downloader%get_file(target_url, tmp_pkg_file, error)
679679
if (allocated(error)) then
680680
close (unit, status='delete'); return
681681
end if
682682

683683
! Unpack the downloaded package to the final location.
684-
call downloader%unpack(tmp_pkg_data_file, cache_path, error)
684+
call downloader%unpack(tmp_pkg_file, cache_path, error)
685685
close (unit, status='delete')
686686
if (allocated(error)) return
687687
end if
@@ -1082,7 +1082,7 @@ subroutine dump_to_unit(self, unit, error)
10821082
table = toml_table()
10831083
call self%dump(table, error)
10841084

1085-
write(unit, '(a)') toml_serialize(table)
1085+
write (unit, '(a)') toml_serialize(table)
10861086

10871087
end subroutine dump_to_unit
10881088

src/fpm/downloader.f90

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ module fpm_downloader
1818
contains
1919

2020
!> Perform an http get request and save output to file.
21-
subroutine get_pkg_data(url, version, tmp_pkg_data_file, json, error)
21+
subroutine get_pkg_data(url, version, tmp_pkg_file, json, error)
2222
character(*), intent(in) :: url
2323
type(version_t), allocatable, intent(in) :: version
24-
character(*), intent(in) :: tmp_pkg_data_file
24+
character(*), intent(in) :: tmp_pkg_file
2525
type(json_object), intent(out) :: json
2626
type(error_t), allocatable, intent(out) :: error
2727

@@ -31,14 +31,14 @@ subroutine get_pkg_data(url, version, tmp_pkg_data_file, json, error)
3131

3232
if (allocated(version)) then
3333
! Request specific version.
34-
call get_file(url//'/'//version%s(), tmp_pkg_data_file, error)
34+
call get_file(url//'/'//version%s(), tmp_pkg_file, error)
3535
else
3636
! Request latest version.
37-
call get_file(url, tmp_pkg_data_file, error)
37+
call get_file(url, tmp_pkg_file, error)
3838
end if
3939
if (allocated(error)) return
4040

41-
call json_load(j_value, tmp_pkg_data_file, error=j_error)
41+
call json_load(j_value, tmp_pkg_file, error=j_error)
4242
if (allocated(j_error)) then
4343
allocate (error); call move_alloc(j_error%message, error%message); call json%destroy(); return
4444
end if
@@ -51,19 +51,19 @@ subroutine get_pkg_data(url, version, tmp_pkg_data_file, json, error)
5151
json = ptr
5252
end
5353

54-
subroutine get_file(url, tmp_pkg_data_file, error)
54+
subroutine get_file(url, tmp_pkg_file, error)
5555
character(*), intent(in) :: url
56-
character(*), intent(in) :: tmp_pkg_data_file
56+
character(*), intent(in) :: tmp_pkg_file
5757
type(error_t), allocatable, intent(out) :: error
5858

5959
integer :: stat
6060

6161
if (which('curl') /= '') then
6262
print *, "Downloading package data from '"//url//"' ..."
63-
call execute_command_line('curl '//url//' -s -o '//tmp_pkg_data_file, exitstat=stat)
63+
call execute_command_line('curl '//url//' -s -o '//tmp_pkg_file, exitstat=stat)
6464
else if (which('wget') /= '') then
6565
print *, "Downloading package data from '"//url//"' ..."
66-
call execute_command_line('wget '//url//' -q -O '//tmp_pkg_data_file, exitstat=stat)
66+
call execute_command_line('wget '//url//' -q -O '//tmp_pkg_file, exitstat=stat)
6767
else
6868
call fatal_error(error, "Neither 'curl' nor 'wget' installed."); return
6969
end if
@@ -73,8 +73,9 @@ subroutine get_file(url, tmp_pkg_data_file, error)
7373
end if
7474
end
7575

76-
subroutine unpack(tmp_file, destination, error)
77-
character(*), intent(in) :: tmp_file
76+
!> Unpack a tarball to a destination.
77+
subroutine unpack(tmp_pkg_file, destination, error)
78+
character(*), intent(in) :: tmp_pkg_file
7879
character(*), intent(in) :: destination
7980
type(error_t), allocatable, intent(out) :: error
8081

@@ -84,11 +85,11 @@ subroutine unpack(tmp_file, destination, error)
8485
call fatal_error(error, "'tar' not installed."); return
8586
end if
8687

87-
print *, "Unpacking '"//tmp_file//"' to '"//destination//"' ..."
88-
call execute_command_line('tar -zxf '//tmp_file//' -C '//destination, exitstat=stat)
88+
print *, "Unpacking '"//tmp_pkg_file//"' to '"//destination//"' ..."
89+
call execute_command_line('tar -zxf '//tmp_pkg_file//' -C '//destination, exitstat=stat)
8990

9091
if (stat /= 0) then
91-
call fatal_error(error, "Error unpacking '"//tmp_file//"'."); return
92+
call fatal_error(error, "Error unpacking '"//tmp_pkg_file//"'."); return
9293
end if
9394
end
9495
end

test/fpm_test/test_package_dependencies.f90

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,10 +1350,10 @@ subroutine setup_global_settings(global_settings, error)
13501350
global_settings%config_file_name = config_file_name
13511351
end
13521352

1353-
subroutine get_pkg_data(url, version, tmp_file, json, error)
1353+
subroutine get_pkg_data(url, version, tmp_pkg_file, json, error)
13541354
character(*), intent(in) :: url
13551355
type(version_t), allocatable, intent(in) :: version
1356-
character(*), intent(in) :: tmp_file
1356+
character(*), intent(in) :: tmp_pkg_file
13571357
type(json_object), intent(out) :: json
13581358
type(error_t), allocatable, intent(out) :: error
13591359

@@ -1372,20 +1372,20 @@ subroutine get_pkg_data(url, version, tmp_file, json, error)
13721372
json = cast_to_object(j_value)
13731373
end
13741374

1375-
subroutine get_file(url, tmp_file, error)
1375+
subroutine get_file(url, tmp_pkg_file, error)
13761376
character(*), intent(in) :: url
1377-
character(*), intent(in) :: tmp_file
1377+
character(*), intent(in) :: tmp_pkg_file
13781378
type(error_t), allocatable, intent(out) :: error
13791379
end
13801380

1381-
subroutine unpack_mock_package(tmp_file, destination, error)
1382-
character(*), intent(in) :: tmp_file
1381+
subroutine unpack_mock_package(tmp_pkg_file, destination, error)
1382+
character(*), intent(in) :: tmp_pkg_file
13831383
character(*), intent(in) :: destination
13841384
type(error_t), allocatable, intent(out) :: error
13851385

13861386
integer :: stat
13871387

1388-
call execute_command_line('cp '//tmp_file//' '//destination, exitstat=stat)
1388+
call execute_command_line('cp '//tmp_pkg_file//' '//destination, exitstat=stat)
13891389

13901390
if (stat /= 0) then
13911391
call test_failed(error, "Failed to create mock package"); return

0 commit comments

Comments
 (0)