Skip to content

Commit 03bc0a1

Browse files
committed
Allow running generate_code.py from anywhere
Previously you had to run it from inside the same directory, but it's less likely to mess up newbs if you can run it from anywhere.
1 parent e347958 commit 03bc0a1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pandas/src/generate_code.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
from __future__ import print_function
9+
import os
910
from pandas.compat import StringIO
1011
import numpy as np
1112

@@ -2536,7 +2537,12 @@ def generate_from_template(template, exclude=None):
25362537
take_2d_multi_template]
25372538

25382539

2539-
def generate_take_cython_file(path='generated.pyx'):
2540+
def generate_take_cython_file():
2541+
# Put `generated.pyx` in the same directory as this file
2542+
directory = os.path.dirname(os.path.realpath(__file__))
2543+
filename = 'generated.pyx'
2544+
path = os.path.join(directory, filename)
2545+
25402546
with open(path, 'w') as f:
25412547
print(warning_to_new_contributors, file=f)
25422548
print(header, file=f)

0 commit comments

Comments
 (0)