Skip to content
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

Executing expand.py from outer dir #98

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions expand.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import getopt
import tempfile
import subprocess
import pathlib

usage = '''Usage:expand.py [options] <output modules>
Output Modules:
Expand Down Expand Up @@ -43,14 +44,14 @@
'scc': ('internal_scc',),
'segtree': ('internal_bit', 'internal_type_traits',),
'twosat': ('internal_scc',), }
src_path = 'src/'
src_path = pathlib.Path(sys.argv[0]).parent.joinpath('src')
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

execution from . also success

% python3 ${HOME}/src/github.com/rust-lang-ja/ac-library-rs/expand.py segtree | pbcopy
%



def output_file(filename):
global src_path

res = []
with open(src_path+filename+'.rs', 'r') as f:
with open(src_path.joinpath(filename+'.rs'), 'r') as f:
res.append('pub mod {} {{'.format(filename))

for line in f:
Expand Down