Skip to content

gpython: Display build information and support some builtin attribute #44

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

Open
1 of 4 tasks
corona10 opened this issue Dec 26, 2018 · 8 comments
Open
1 of 4 tasks
Labels
good first issue Good for newcomers

Comments

@corona10
Copy link
Collaborator

corona10 commented Dec 26, 2018

Likewise, PyPy3, if we can display build information such as commit information, go version.
it will be awesome.

Python 3.5.3 (fdd60ed87e941677e8ea11acf9f1819466521bf2, Apr 26 2018, 01:23:42)
[PyPy 6.0.0 with GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

Also, we need to implement copyright, creditsand license as a built-in attribute.

  • copyright
  • credits
  • license
  • build info
@corona10
Copy link
Collaborator Author

corona10 commented Dec 26, 2018

@ncw @sbinet
What do you think about displaying build information?
And it will be able to implement it without 3rd party library?

@corona10 corona10 changed the title gpython: Display build information and support some builtin variable gpython: Display build information and support some builtin attribute Dec 26, 2018
@corona10
Copy link
Collaborator Author

Looks like we can inject the commit log by using ldflag during build time.

@ncw
Copy link
Collaborator

ncw commented Dec 26, 2018

This is slightly awkward to do as it can't be done using the standard go build (at least I haven't figured out how!)

I do this in rclone and I have a Makefile which does the build

https://github.com/ncw/rclone/blob/39eac7a7658494a5404dfd75c80f0be3e6d222b2/Makefile#L35

If you build rclone not via the Makefile you get a v1.45-DEV build

I'm pretty sure you can do this with go-releaser which we use to build the release binaries.

I had a chat with the debian maintainer about rclone and this issue, and his thoughts were that the program should build using the normal go tools to make the correct version number at the releases. Which kind of implies when we make a release, we should check in the build description. That is what I do in rclone anyway, but the Makefile adds a git ID for non release builds.

@corona10
Copy link
Collaborator Author

@ncw
Yeah looks like rclone way is the best way from now on.
@sbinet Do you have any ideas?

@sbinet
Copy link
Member

sbinet commented Dec 28, 2018

not sure there's anything else than what rclone does.
go generate isn't run by default, so that's out.

if we wanted to also support Windows, we could perhaps use mage, but that's another tool to install...
so, yeah, the rclone way is fine by me.

@ncw
Copy link
Collaborator

ncw commented Dec 29, 2018

Probably the simplest thing is to go with what goreleaser provides us with:

So make a version.go file with this in

package main

var (
	version = "dev"
	commit  = "none"
	date    = "unknown"
)

Then the release builds will have the correct version, commit and date in. The dev builds will have "dev" "none" and "unknown".

Python 3.5.3 (fdd60ed87e941677e8ea11acf9f1819466521bf2, Apr 26 2018, 01:23:42)
[PyPy 6.0.0 with GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

This provides most of what we need here.

Note that we should show the go runtime version os and arch too as that is really important debugging info.

	fmt.Printf("- os/arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
	fmt.Printf("- go version: %s\n", runtime.Version())

@corona10
Copy link
Collaborator Author

corona10 commented Jan 1, 2019

@ncw LGTM

@corona10 corona10 added the good first issue Good for newcomers label Jan 2, 2019
@corona10
Copy link
Collaborator Author

corona10 commented Jan 2, 2019

Looks like a good first issue for a newbie of this project.

  • Display build information

corona10 pushed a commit that referenced this issue Mar 3, 2019
* #44 Display build information

* #44 Display build information (makefile was deleted)

* #44 copyright header  was added

* #44 move out print from cli.go

* #44 import order in cli.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants