Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
brew
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
brew
Commits
1593b24b
Commit
1593b24b
authored
10 years ago
by
Tim D. Smith
Browse files
Options
Downloads
Patches
Plain Diff
caveats: recommend adding python site-packages with site.addsitedir
Closes Homebrew/homebrew#33364. Fixes Homebrew/homebrew#30844.
parent
809e048b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Library/Homebrew/caveats.rb
+40
-13
40 additions, 13 deletions
Library/Homebrew/caveats.rb
with
40 additions
and
13 deletions
Library/Homebrew/caveats.rb
+
40
−
13
View file @
1593b24b
...
@@ -48,21 +48,48 @@ class Caveats
...
@@ -48,21 +48,48 @@ class Caveats
def
python_caveats
def
python_caveats
return
unless
keg
return
unless
keg
return
unless
keg
.
python_site_packages_installed?
return
unless
keg
.
python_site_packages_installed?
return
if
Formula
[
"python"
].
installed?
site_packages
=
if
f
.
keg_only?
s
=
nil
"
#{
f
.
opt_prefix
}
/lib/python2.7/site-packages"
homebrew_site_packages
=
Language
::
Python
.
homebrew_site_packages
else
user_site_packages
=
Language
::
Python
.
user_site_packages
"python"
"
#{
HOMEBREW_PREFIX
}
/lib/python2.7/site-packages"
pth_file
=
user_site_packages
/
"homebrew.pth"
instructions
=
<<-
EOS
.
undent
.
gsub
(
/^/
,
" "
)
mkdir -p
#{
user_site_packages
}
echo 'import site; site.addsitedir("
#{
homebrew_site_packages
}
")' >>
#{
pth_file
}
EOS
if
f
.
keg_only?
keg_site_packages
=
f
.
opt_prefix
/
"lib/python2.7/site-packages"
unless
Language
::
Python
.
in_sys_path?
(
"python"
,
keg_site_packages
)
s
=
<<-
EOS
.
undent
If you need Python to find bindings for this keg-only formula, run:
echo
#{
keg_site_packages
}
>>
#{
homebrew_site_packages
/
f
.
name
}
.pth
EOS
s
+=
instructions
unless
Language
::
Python
.
reads_brewed_pth_files?
(
"python"
)
end
return
s
end
end
dir
=
"~/Library/Python/2.7/lib/python/site-packages"
dir_path
=
Pathname
.
new
(
dir
).
expand_path
return
if
Language
::
Python
.
reads_brewed_pth_files?
(
"python"
)
file
=
"
#{
dir
}
/homebrew.pth"
file_path
=
Pathname
.
new
(
file
).
expand_path
if
!
Language
::
Python
.
in_sys_path?
(
"python"
,
homebrew_site_packages
)
if
!
file_path
.
readable?
||
!
file_path
.
read
.
include?
(
site_packages
)
s
=
<<-
EOS
.
undent
s
=
"If you need Python to find the installed site-packages:
\n
"
Python modules have been installed and Homebrew's site-packages is not
s
+=
" mkdir -p
#{
dir
}
\n
"
unless
dir_path
.
exist?
in your Python sys.path, so you will not be able to import the modules
s
+=
" echo '
#{
site_packages
}
' >
#{
file
}
"
this formula installed. If you plan to develop with these modules,
please run:
EOS
s
+=
instructions
elsif
keg
.
python_pth_files_installed?
s
=
<<-
EOS
.
undent
This formula installed .pth files to Homebrew's site-packages and your
Python isn't configured to process them, so you will not be able to
import the modules this formula installed. If you plan to develop
with these modules, please run:
EOS
s
+=
instructions
end
end
s
end
end
def
app_caveats
def
app_caveats
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment