-
Notifications
You must be signed in to change notification settings - Fork 108
Refactor run command #229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor run command #229
Conversation
So far the code looks good and is passing many tests but ran into I am excited on how well it it working on a machine with no bootstrap I like the change to just show the pathname with On a machine with just a single Fortran source built from #pr229 So this is the only issue I have to raise at this point ... When an executable does not exist there is no message. ffpm new A --lib
cd A
ffpm run
ffpm test This is different than the h-fpm version, which produces a warning ffpm run this_is_a_typo does not warn that there is no such executable. I think it should produce
maybe just a message to say to use the --list option to see available choices when an unknown name is entered? |
A minor inconsistency. The default search includes the current directory I like the concept of having a project in a directory with So if I have a directory that contains nothing but "main.f90" and the CASE Iname = "test"
[build]
auto-executables = false
[[executable]]
name="testit"
source-dir="."
main="main.f90" but if I just have a CASE IIname = "test" I get
So it acts like the current directory is not automatically searched. But if I change the CASE IIIname = "test"
[[executable]]
name="testit"
source-dir="."
main="main.f90" It builds two executables, The documentation for the Another approach would be to have it find and build without the I think others might argue it should only allow pathnames below the |
@urbanjost, I like the idea of a minimal two file project - it was not a test case I thought of testing before. It looks like there's a bug in the source processing of explicit |
That was fast. Perfect for #!/bin/bash
(
exec 2>&1
set -x
ffpm run asdf
ffpm new A -lib
cd A
ffpm run <<<< NO OUTPUT?
ffpm run empty
)|tee -a $0
exit
|
This is an edge case but it looks like it would only take a few lines to warn the user something went wrong. name = "test"
[[executable]]
name="testit"
source-dir="."
main="main.f90"
[[executable]]
name="testit"
source-dir="other"
main="main.f90"
[[executable]]
name="testit"
source-dir="other"
main="main2.f90" In a intentionally setup with intentional duplicates both h-fpm and fpm build --list so I think it would be relatively easy to warn when there are duplicate In my testcase the filesystem looks like
I agree this an aberrant case but it looks like the warning would be easy I much bigger change would be to put the executables into separate directories like h-fpm but unless the run command took subdirectory names that really does not solve the issue; and if the user is warned they can easily (probably) resolve it by giving a unique name to the output executable in the |
When I took a second look there is a fixed format of 17 characters, which I sometimes
I cleaner way would require two passes to find the longest string I think. Maybe there is a simpler way you see. A kludge that index 31927fc..d852cb6 100644
--- a/fpm/src/fpm.f90
+++ b/fpm/src/fpm.f90
@@ -304,7 +304,7 @@ subroutine cmd_run(settings,test)
class(fpm_run_settings), intent(in) :: settings
logical, intent(in) :: test
- integer :: i, j
+ integer :: i, j, column_width
logical :: found(size(settings%name))
type(error_t), allocatable :: error
type(package_t) :: package
@@ -382,8 +382,8 @@ subroutine cmd_run(settings,test)
j = 1
write(stderr,*) 'Available names:'
+ column_width=17
do i=1,size(model%targets)
-
exe_target => model%targets(i)%ptr
if (exe_target%target_type == FPM_TARGET_EXECUTABLE .and. &
@@ -394,7 +394,9 @@ subroutine cmd_run(settings,test)
if (exe_source%unit_scope == &
merge(FPM_SCOPE_TEST,FPM_SCOPE_APP,test)) then
- write(stderr,'(A17)',advance=(merge("yes","no ",modulo(j,4)==0))) basename(exe_target%output_file)
+ column_width=max(column_width,len(basename(exe_target%output_file))+1)
+ write(stderr,'(A)',advance=(merge("yes","no ",modulo(j,4)==0))) &
+ & [character(len=column_width) ::basename(exe_target%output_file)]
j = j + 1
I was looking for a quick way to find the longest name and did not see it off the bat and thought I would show you this first before looking deeper. Maybe just listing the basenames instead of the table is simpler. I do not know how common having this many applications or tests is. I happen to try to have a demo as part of each manpage; which can add up quickly. |
FYI: worked very nicely with a module of mine called M_system that contained a C file that required me to use an fpm..mk file with |
When outputting a list of available run/test targets, format the output columns nicely depending on the maximum length of the targets.
Source directories specified in [[executable]] and [[test]] are not searched recursively. Fixes issue with having programs in the root directory.
All the other tests I have passed other than what I commented on. I am moving a few repositories to use the new fpm but unless I stumble on something all my tests are complete. Seems like a bootstrappable single Fortran file would be due for people to experiment with? They would just need a Fortran compiler and gfortran. |
A build of this branch placed into a single file and built with a simple "gfortran ffpm.f90" on a machine with |
PS: wget http://www.urbanjost.altervista.org/REMOVE/ffpm.f90
gfortran ffpm.f90 -o ffpm I am going to leave the file ffpm.f90 available for a week that can be accessed via a browser or something like the wget(1) above. If anyone has access to compilers other than gfortran I am very curious if the file compiles and runs. The fiile is |
I have used Intel Fortran version 2018 to compile the file. It produced
quite a few error messages - see the attachment.
Two of the error messages were easily corrected - stop abs(sig) is not
allowed - stop comes with a constant only - and the message about
allocating a zero-length string disappears when you change the asterisk to
a colon. However, the messages about get_value are more demanding. I have
not looked at them in any detail :)
Op wo 11 nov. 2020 om 03:19 schreef urbanjost <[email protected]>:
PS:
wget http://www.urbanjost.altervista.org/REMOVE/ffpm.f90
gfortran ffpm.f90 -o ffpm
I am going to leave the file ffpm.f90 available for a week that can be
accessed via a browser or something like the *wget(1)* above. If anyone
has access to compilers other than gfortran I am very curious if the file
compiles and runs. The fiile is fpm #229
<#229>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#229 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN6YR6OYXSQ2NVJTMFNGY3SPHYDBANCNFSM4TMSJTHQ>
.
Intel(R) Visual Fortran Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 18.0.5.274 Build 20180823
Copyright (C) 1985-2018 Intel Corporation. All rights reserved.
ffpm.f90(1836): error #8231: In an ALLOCATE statement the type parameter values in type specification shall be an asterisk if and only if each object being allocated is a dummy argument for which the type parameter is assumed. [STRINGS]
allocate(character(len=0)::strings(0))
------------------------------------^
ffpm.f90(1841): error #8231: In an ALLOCATE statement the type parameter values in type specification shall be an asterisk if and only if each object being allocated is a dummy argument for which the type parameter is assumed. [STRINGS]
allocate(character(len=0)::strings(0))
---------------------------------^
ffpm.f90(2659): remark #8291: Recommended relationship between field width 'W' and the number of fractional digits 'D' in this edit descriptor is 'W>=D+7'.
read(nan_string,'(g3.3)')valu
----------------------------^
ffpm.f90(5230): error #6345: Either a PAUSE, STOP or ERROR STOP statement has an invalid argument. [ABS]
stop abs(sig)
-----------^
ffpm.f90(6756): warning #6843: A dummy argument with an explicit INTENT(OUT) declaration is not given an explicit value. [SELF]
subroutine new_keyval(self)
----------------------^
ffpm.f90(10108): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, present(default), stat)
--------^
ffpm.f90(10146): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, present(default), stat)
--------^
ffpm.f90(10184): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, present(default), stat)
--------^
ffpm.f90(10222): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, present(default), stat)
--------^
ffpm.f90(10260): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, present(default), stat)
--------^
ffpm.f90(10298): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, present(default), stat)
--------^
ffpm.f90(10336): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, present(default), stat)
--------^
ffpm.f90(10374): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, present(default), stat)
--------^
ffpm.f90(10409): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, .true., stat)
--------^
ffpm.f90(10439): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, .true., stat)
--------^
ffpm.f90(10469): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, .true., stat)
--------^
ffpm.f90(10499): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, .true., stat)
--------^
ffpm.f90(10529): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, .true., stat)
--------^
ffpm.f90(10559): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, .true., stat)
--------^
ffpm.f90(10589): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, .true., stat)
--------^
ffpm.f90(10619): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(table, key, ptr, .true., stat)
--------^
ffpm.f90(10946): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(array, pos, ptr, stat)
--------^
ffpm.f90(10974): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(array, pos, ptr, stat)
--------^
ffpm.f90(11002): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(array, pos, ptr, stat)
--------^
ffpm.f90(11030): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(array, pos, ptr, stat)
--------^
ffpm.f90(11058): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(array, pos, ptr, stat)
--------^
ffpm.f90(11086): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(array, pos, ptr, stat)
--------^
ffpm.f90(11114): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(array, pos, ptr, stat)
--------^
ffpm.f90(11142): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(array, pos, ptr, stat)
--------^
ffpm.f90(11170): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(array, pos, ptr, stat)
--------^
ffpm.f90(11174): error #6285: There is no matching specific subroutine for this generic subroutine call. [ADD_KEYVAL]
call add_keyval(array, ptr, stat)
--------------^
ffpm.f90(11204): error #6285: There is no matching specific subroutine for this generic subroutine call. [GET_VALUE]
call get_value(array, pos, ptr, stat)
--------^
ffpm.f90(11446): catastrophic error: Too many errors, exiting
compilation aborted for ffpm.f90 (code 1)
|
Thanks. That is basically all one issue I believe. Interesting differences. |
@arjenmarkus I'm responsible for parts of those issues with TOML-Fortran ( |
@LKedward @awvwgk Considering this, is there a preferred order to merging? Should this PR wait for #233 or it doesn't matter? |
Doesn't matter too much. In case there is a fix required in this PR as well, updating the TOML-Fortran dependency is just a simple patch version bump: diff --git a/fpm/fpm.toml b/fpm/fpm.toml
index fc3a381..404e65c 100644
--- a/fpm/fpm.toml
+++ b/fpm/fpm.toml
@@ -8,7 +8,7 @@ copyright = "2020 fpm contributors"
[dependencies]
[dependencies.toml-f]
git = "https://github.com/toml-f/toml-f"
-tag = "v0.2"
+tag = "v0.2.1"
[dependencies.M_CLI2]
git = "https://github.com/urbanjost/M_CLI2.git" |
The fix isn't required for this PR and I have no preferred order of merging. |
Sounds good, I will merge this. |
This PR simplifies the run command implementation to use information provided by the
model%targets
structure. This avoids the duplication of code which has caused the run command to construct executable paths differently to the build command; this PR fixes this problem.