[ 
https://issues.apache.org/jira/browse/CASSANDRA-17684?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Brad Schoening updated CASSANDRA-17684:
---------------------------------------
    Description: 
On MacOS, /usr/share is not writable – even by root. Instead, /usr/local/share 
is the preferred location.

The current share directory path is /usr/share/doc/cassandra/CQL.html.  This 
would just add an alternative path.

Using a list comprehension would simplify the current code.  E.g.,     
{quote}import pathlib

HTML_FALLBACK = 'https://cassandra.apache.org/doc/latest/cql/index.html'

loc = [ f"\{pkgpath}/doc/cql3/CQL.html', "/usr/share/doc/cassandra/CQL.html", 
"{color:#4c9aff}/usr/local/share{color}/doc/cassandra/CQL.html" ]

item = next((x.as_uri() for x in loc if Path( x ).exists()), HTML_FALLBACK)
{quote}
Homebrew doesn't install the doc files, so this would likely need either

a) added to homebrew in 
[https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/cassandra.rb]

or

b) installed with pip's setup.cql and accessed with Python's 
[importlib.resources|https://docs.python.org/3/library/importlib.resources.html]

 

Approach B:

1. build.xml should place the file into the package

one

 
{code:java}
 <target name="docs">
       <copy todir="${dist.dir}/pylib/cqlshlib/doc" failonerror="false">
        <fileset dir="doc/cql3">
          <include name="CQL.html" />
        </fileset>
      </copy>
      <touch file="${dist.dir}/pylib/cqlshlib/doc/__init__.py" />
    </target>{code}
 

two

2. Setup.py should include the HTML file
{code:java}
package_data={
    'cqlshlib': ['doc/*.html'],
},
include_package_data=True,{code}
3.  Change setup_docspath() to look for a local file:

 
{code:java}
def setup_docspath():
    global docspath
    cqlshlib_dir = os.path.dirname(os.path.realpath(__file__))
    docspath = os.path.join(cqlshlib_dir, 'doc')
{code}
 

  was:
On MacOS, /usr/share is not writable – even by root. Instead, /usr/local/share 
is the preferred location.

The current share directory path is /usr/share/doc/cassandra/CQL.html.  This 
would just add an alternative path.

Using a list comprehension would simplify the current code.  E.g.,     
{quote}import pathlib

HTML_FALLBACK = 'https://cassandra.apache.org/doc/latest/cql/index.html'

loc = [ f"\{pkgpath}/doc/cql3/CQL.html', "/usr/share/doc/cassandra/CQL.html", 
"{color:#4c9aff}/usr/local/share{color}/doc/cassandra/CQL.html" ]

item = next((x.as_uri() for x in loc if Path( x ).exists()), HTML_FALLBACK)
{quote}
Homebrew doesn't install the doc files, so this would likely need either

a) added to homebrew in 
[https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/cassandra.rb]

or

b) installed with pip's setup.cql and accessed with Python's 
[importlib.resources|https://docs.python.org/3/library/importlib.resources.html]

 

Approach B:

1. build.xml should place the file into the package

2. Setup.py should include the HTML file
{code:java}
package_data={
    'cqlshlib': ['doc/*.html'],
},
include_package_data=True,{code}
3.  Change setup_docspath() to look for a local file:

 
{code:java}
def setup_docspath():
    global docspath
    cqlshlib_dir = os.path.dirname(os.path.realpath(__file__))
    docspath = os.path.join(cqlshlib_dir, 'doc')
{code}
 


> MacOS install should include cql.html local help file
> -----------------------------------------------------
>
>                 Key: CASSANDRA-17684
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-17684
>             Project: Apache Cassandra
>          Issue Type: Improvement
>          Components: CQL/Interpreter
>            Reporter: Brad Schoening
>            Priority: Normal
>             Fix For: 5.x
>
>
> On MacOS, /usr/share is not writable – even by root. Instead, 
> /usr/local/share is the preferred location.
> The current share directory path is /usr/share/doc/cassandra/CQL.html.  This 
> would just add an alternative path.
> Using a list comprehension would simplify the current code.  E.g.,     
> {quote}import pathlib
> HTML_FALLBACK = 'https://cassandra.apache.org/doc/latest/cql/index.html'
> loc = [ f"\{pkgpath}/doc/cql3/CQL.html', "/usr/share/doc/cassandra/CQL.html", 
> "{color:#4c9aff}/usr/local/share{color}/doc/cassandra/CQL.html" ]
> item = next((x.as_uri() for x in loc if Path( x ).exists()), HTML_FALLBACK)
> {quote}
> Homebrew doesn't install the doc files, so this would likely need either
> a) added to homebrew in 
> [https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/cassandra.rb]
> or
> b) installed with pip's setup.cql and accessed with Python's 
> [importlib.resources|https://docs.python.org/3/library/importlib.resources.html]
>  
> Approach B:
> 1. build.xml should place the file into the package
> one
>  
> {code:java}
>  <target name="docs">
>        <copy todir="${dist.dir}/pylib/cqlshlib/doc" failonerror="false">
>         <fileset dir="doc/cql3">
>           <include name="CQL.html" />
>         </fileset>
>       </copy>
>       <touch file="${dist.dir}/pylib/cqlshlib/doc/__init__.py" />
>     </target>{code}
>  
> two
> 2. Setup.py should include the HTML file
> {code:java}
> package_data={
>     'cqlshlib': ['doc/*.html'],
> },
> include_package_data=True,{code}
> 3.  Change setup_docspath() to look for a local file:
>  
> {code:java}
> def setup_docspath():
>     global docspath
>     cqlshlib_dir = os.path.dirname(os.path.realpath(__file__))
>     docspath = os.path.join(cqlshlib_dir, 'doc')
> {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to