Skip to content

Commit

Permalink
Merge pull request #2 from gotray/initial
Browse files Browse the repository at this point in the history
fix ci on windows
  • Loading branch information
cpunion authored Nov 22, 2024
2 parents 0ca3cf8 + bdbadfd commit b2c3ba7
Show file tree
Hide file tree
Showing 13 changed files with 41 additions and 21 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,29 @@ jobs:
with:
go-version: 1.23

- uses: actions/setup-python@v5
with:
python-version: '3.13'
update-environment: true

- name: Generate Python pkg-config for windows (patch)
if: matrix.os == 'windows-latest'
run: |
mkdir -p $PKG_CONFIG_PATH
cp .github/assets/python3-embed.pc $PKG_CONFIG_PATH/
- name: Install tiny-pkg-config for windows (patch)
if: matrix.os == 'windows-latest'
run: |
set -x
curl -L https://github.com/cpunion/tiny-pkg-config/releases/download/v0.2.0/tiny-pkg-config_Windows_x86_64.zip -o /tmp/tiny-pkg-config.zip
unzip /tmp/tiny-pkg-config.zip -d $HOME/bin
mv $HOME/bin/tiny-pkg-config.exe $HOME/bin/pkg-config.exe
echo $PKG_CONFIG_PATH
cat $PKG_CONFIG_PATH/python3-embed.pc
pkg-config --libs python3-embed
pkg-config --cflags python3-embed
- name: Build
run: go install -v ./...

Expand Down
10 changes: 5 additions & 5 deletions cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ var initCmd = &cobra.Command{
If no path is provided, it will initialize in the current directory.
Example:
gopy init
gopy init my-project
gopy init --debug my-project
gopy init -v my-project`,
got init
got init my-project
got init --debug my-project
got init -v my-project`,
Run: func(cmd *cobra.Command, args []string) {
// Get project path
projectPath := "."
Expand Down Expand Up @@ -111,7 +111,7 @@ Example:
fmt.Printf("\n%s\n", bold("Successfully initialized go-python project in "+projectPath))
fmt.Println("\nNext steps:")
fmt.Println("1. cd", projectPath)
fmt.Println("2. gopy run .")
fmt.Println("2. got run .")
},
}

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions cmd/internal/create/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/fatih/color"
)

//go:embed templates/*
//go:embed _templates/*
var templates embed.FS

var (
Expand Down Expand Up @@ -52,18 +52,18 @@ func Project(projectPath string, verbose bool) error {
overwriteAll := false

// Walk through template files and copy them
err := fs.WalkDir(templates, "templates", func(path string, d fs.DirEntry, err error) error {
err := fs.WalkDir(templates, "_templates", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}

// Skip the templates root directory
if path == "templates" {
if path == "_templates" {
return nil
}

// Get relative path from templates directory
relPath, err := filepath.Rel("templates", path)
relPath, err := filepath.Rel("_templates", path)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/create/create_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
// setupTestDir creates a temporary directory for testing
func setupTestDir(t *testing.T) string {
t.Helper()
dir, err := os.MkdirTemp("", "gopy-test-*")
dir, err := os.MkdirTemp("", "got-test-*")
if err != nil {
t.Fatalf("failed to create temp dir: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/install/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func getCacheDir() (string, error) {
if err != nil {
return "", fmt.Errorf("failed to get user home directory: %v", err)
}
cacheDir := filepath.Join(homeDir, ".gopy", "cache")
cacheDir := filepath.Join(homeDir, ".got", "cache")
if err := os.MkdirAll(cacheDir, 0755); err != nil {
return "", fmt.Errorf("failed to create cache directory: %v", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/install/deps.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func installGoDeps(projectPath string) error {
}()

fmt.Println("Installing Go dependencies...")
getCmd := exec.Command("go", "get", "-u", "github.com/gotray/go-python")
getCmd := exec.Command("go", "mod", "tidy")
getCmd.Stdout = os.Stdout
getCmd.Stderr = os.Stderr
if err := getCmd.Run(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/internal/install/python_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestGetCacheDir(t *testing.T) {
return
}

want := filepath.Join(tmpDir, ".gopy", "cache")
want := filepath.Join(tmpDir, ".got", "cache")
if got != want {
t.Errorf("getCacheDir() = %v, want %v", got, want)
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/internal/rungo/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func FindProjectRoot(dir string) (string, error) {
}
parentDir := filepath.Dir(dir)
if parentDir == dir {
return "", fmt.Errorf("failed to find Gopy project")
return "", fmt.Errorf("failed to find Got project")
}
return FindProjectRoot(parentDir)
}
Expand All @@ -89,7 +89,7 @@ func RunCommand(command string, args []string) error {
}
projectRoot, err := FindProjectRoot(wd)
if err != nil {
return fmt.Errorf("should run this command in a Gopy project: %v", err)
return fmt.Errorf("should run this command in a Got project: %v", err)
}
env.SetBuildEnv(projectRoot)

Expand Down
6 changes: 3 additions & 3 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "gopy",
Use: "got",
Short: "A tool for building Go applications with Python integration",
Long: `gopy is a command line tool that helps you build, run and manage Go applications
Long: `got is a command line tool that helps you build, run and manage Go applications
that integrate with Python.
It provides commands to:
Expand All @@ -23,7 +23,7 @@ It provides commands to:
- Install Go packages with Python dependencies
- Add or remove Python packages to/from your project
Use "gopy help [command]" for more information about a command.`,
Use "got help [command]" for more information about a command.`,
// Uncomment the following line if your bare application
// has an action associated with it:
// Run: func(cmd *cobra.Command, args []string) { },
Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.23.3

require (
github.com/fatih/color v1.18.0
github.com/gotray/go-python v0.3.0
github.com/klauspost/compress v1.17.11
github.com/spf13/cobra v1.8.1
go.uber.org/zap v1.27.0
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
github.com/gotray/go-python v0.3.0 h1:7NfFBdACraCkSOEUJqSA0q6LNtFSwOeO3axdNOtHqqI=
github.com/gotray/go-python v0.3.0/go.mod h1:v4XHhlcdQJQPn4Dt+Ft4eFiL4vlsi5ZKboRCSUWe/xc=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc=
Expand Down

0 comments on commit b2c3ba7

Please sign in to comment.